Click here to Skip to main content
15,913,283 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How constructor chaining work in base class and derived class concept with this key word?
Posted

It works differently in c#

If you have something like this:

C#
ClassA
{
   public string ClassName{get; private set;}
   public ClassA(string name)
   {
   }
}


And you create a class B which inherrits from it you can chain constructors like this:

C#
ClassB : ClassA
{
   public ClassB(string name) : base(name)
   {
   }
}

This is a very loose example just to give you an idea.
 
Share this answer
 
Check this article:
Constructor Chaining in C#

Regards,
Ibrahim Karakira
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900