Chaining Constructor
what is chaining constructor?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 8, 2013, 10:47 PM EDT
class MeaningOfLife
{
public MeaningOfLife() : this (42)
{
// default constructor, passes 42 to other one which does the work
}
public MeaningOfLife(int i)
{
// code
}
}
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Oct 8, 2013, 11:39 PM EDT
Hi,
Constructor Chaining is an approach where a constructor calls another constructor in the same or base class.
Refer to this link for details:
http://www.codeproject.com/Articles/271582/Constructor-Chaining-in-Csharp
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 9, 2013, 1:55 AM EDT
hi,
chaining constructor is an approch in which a constructor calls another constructor in the same class or base class.
please refer following link it might help you.
http://csharp.2000things.com/tag/constructor-chaining/
http://programmers.stackexchange.com/questions/200390/need-help-understanding-constructor-chaining