4
Answers

Multiple Constructors

Ask a question
Hi, How can I call multiple constructors for the following : 
class sample
{
        string str_a;
        int int_b;
        sample()
        {
                /*Constructor - 1*/
        }
        sample(string a) : this()
        {
                /*Constructor - 2*/
                str_a = a;
        }
        sample(int b) : this()
        {
                /*Constructor - 3*/
                int_b = b;
        }
        sample(string a, int b) : this()
        {
                /*4th Constructor*/
        }
}

How can I call the 1,2,3 constructors in 4th constructor in easy way.



Answers (4)