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 the functionality of break and continue in Visual Studio?

2 Answers   JPMorgan Chase,


Does console.writeline() stop printing when it reaches a null character within a string?

0 Answers  


What is data bind in c#?

0 Answers  


Define parsing? Explain how to parse a datetime string?

0 Answers  


Can you store multiple data types in System.Array?

7 Answers  


Difference between directcast and ctype.

0 Answers  


Explain what is an interface in c#?

0 Answers  


Can we instantiate abstract class in c#?

0 Answers  


What is a c# delegate?

0 Answers  


To create a localized application which namespaces are necessary?

0 Answers   Siebel,


What is multiple interface in c#?

0 Answers  


Can we extend sealed class in c#?

0 Answers  


Categories