CAN WE CREATE TWO CONSTRUCTOR OF SAME NAME AND SAME SIGNATURE IN SAME CLASS?

yash Singh

Total Post:15

Points:105
Posted by  yash Singh
C# 
C#
 1690  View(s)
Ratings:
Rate this:

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

Please provide sample of code.
Thanks

  1. Awadhendra Tiwari

    Post:126

    Points:882
    Re: Can we create two constructor of same name and same signature in same class?

    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();

            }

    }

  1. yash Singh

    Post:15

    Points:105
    Re: Can we create two constructor of same name and same signature in same class?

    Thank you

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!