Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

C# provides a default constructor for me. I write a
constructor that takes a string as a parameter, but want to
keep the no parameter one. How many constructors should I write?

Answer Posted / kiran

namespace SameNamespace
{
class MyBaseClass
{
protected internal int myprotectedinternalint;

private string myName;
public MyBaseClass(string abc)
{
myName = abc;
}
public MyBaseClass()
{

}

}
class MyDerivedClass:MyBaseClass
{
public int GetProtectedInternalMember()
{
return myprotectedinternalint;
}
public MyDerivedClass(int myvalue)
{
myprotectedinternalint = myvalue;
}

}

class MyTest
{
public static void Main()
{
MyBaseClass mbc = new MyBaseClass();
MyDerivedClass mdc = new MyDerivedClass(12);

Console.WriteLine(mdc.GetProtectedInternalMember
());
Console.ReadKey();
}
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is method and function in c#?

932


List some of the common data providers for ado.net framework?

807


Can you declare a class or a struct as constant?

992


When do we generally use destructors to release resources?

872


Is Facebook a desktop application?

867


How to use nullable types in .net?

938


Please write a program to display “welcome to bestinterviewquestion.com” in c#?

865


What is the relation between classes and objects?

905


What is writeline in c#?

818


What are "class access modifiers" in C#?

896


What are Uses of CLR

942


To whom a method is accesssed if it is marked as protected internal ?

1021


How objects are stored in memory?

929


In a memory when you Box and Unbox a value-type what happens?

868


What is difference between an Structure and Class?

1056