mahesh gupta

mahesh gupta

  • NA
  • 14
  • 181.9k

Multiple Constructors

Apr 27 2011 10:28 PM
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)