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

Total Post:15

Points:105

C# 
C#
 2128  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. 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();
            }
    }

      Modified On Mar-29-2018 04:07:12 AM
  1. Re: Can we create two constructor of same name and same signature in same class?

    Thank you

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.