Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 640.9k

Nested Class Problem in C#

Dec 27 2011 1:29 AM
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)