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?

Answers were Sorted based on User's Feedback



C# provides a default constructor for me. I write a constructor that takes a string as a parameter,..

Answer / venu gopal

Two. Once you write at least one constructor, C# cancels the
freebie constructor, and now you have to write one yourself,
even if there?s no implementation in it

Is This Answer Correct ?    6 Yes 1 No

C# provides a default constructor for me. I write a constructor that takes a string as a parameter,..

Answer / tsahi

that depends on weather you are writing a class or a struct.
in a class, the first answer given is correct (i.e. two
constructors). in a struct, you cannot write a default
constructor, and you will always have the automatically
generated one, in addition to any other constructor you may
write by your self.

Is This Answer Correct ?    1 Yes 1 No

C# provides a default constructor for me. I write a constructor that takes a string as a parameter,..

Answer / 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

More C Sharp Interview Questions

What is xor operation?

0 Answers  


What does question mark mean in c#?

0 Answers  


If casting fails what type of exception is thrown?

0 Answers  


What is int parse in c#?

0 Answers  


Why abstract class can not be instantiated?

0 Answers  


Define thread?

0 Answers  


Explain the difference between class and interface in .net?

0 Answers  


what does static void Main(string[] args) in C# mean????????

5 Answers   ssinformatics,


List the 5 different access modifiers in c#?

0 Answers  


Why do we use Design Pattern?

1 Answers   Impetus,


what is work of continue statement in C#?

3 Answers  


Distinguish between continue and break statement?

0 Answers  


Categories