Home > DeveloperSection > Forums > Can we create two constructor of same name and same signature in same class?
yash Singh
yash Singh

Total Post:15

Points:105
Posted on    April-24-2011 10:25 AM

 C# C# 
Ratings:


 2 Reply(s)
 1444  View(s)
Rate this:

Can we create two constructor of same name and same signature in same class?

Please provide sample of code.
Thanks



Awadhendra Tiwari

Total Post:126

Points:882
Posted on    April-25-2011 6:10 AM

Yes we can create two construtor with same name and same signature in same class.

class Program

{

        public Program()

        {

            Console.WriteLine("This is instance constructor.");

        }

        static Program()

        {

            Console.WriteLine("This is static constructor.");

        }

        static void Main(string[] args)

        {

            Program pr = new Program();

        }

}


yash Singh
yash Singh

Total Post:15

Points:105
Posted on    April-25-2011 9:56 AM

Thank you

Don't want to miss updates? Please click the below button!

Follow MindStick