Wednesday, 6 January 2016

Instantiating the inner class in c++

 
Instantiating the inner class is same as normal class instantiation. Follow the sample code for better understanding.
#include<iostream>



int a;



struct test

{

   int a;

   struct inner

   {

      void callme()

      {

         a=0;

         printf("\n  :: %d ", a );

         printf("\n  :: %d ", ::a );

      }

   };

};



int main()

{

   test::inner obj;

   obj.callme();

   return 0;

}