Can you call a constructor from another constructor of the Class in .NET?Yes. You
can call a constructor from another constructor using this keyword.
Consider the following example: class sampleClass
{ Output of this code will be: Member1:10 Member2: Good Day! In this example, you created an instance of sampleClass by calling the two argument constructor. In the two argument constructor, you call the one argument constructor in which value for member1 is set. After executing the call, the two argument constructor assigns value to member2.
|