6
Answers

Nested Class Problem in C#

Smart    Lucky

Smart Lucky

12y
1.5k
1
Hi
i have make a program in which two nested classes one is outer class and other is inner class and just i have make their just constructor and i inherit them with the main class demo when ever i make an object of demo class by default outer class constructor is calling can any one tell me why it is calling although i am not making outer class object why it is calling....................? w8ing for rep


class demo :outerClass
    {
        static void Main(string[] arg)
        {
            demo d = new demo();
        }
    }

    class outerClass
    {
        public outerClass()
        { 
               Console.WriteLine ("This is outer constructor");
        }
        class innerClass
        {
            public innerClass()
            {
                Console.WriteLine("This is inner class constructor");
            }
        }
    }









Answers (6)