Coupon Accepted Successfully!


Nested class

When a class is defined in another class, it is known as nesting of classes. In nested class the scope of inner class is restricted by outer class. Simple programming example using public specifier is demonstrated for understanding.

8.42 Write a program to display some message using nested class.


Explanation: In the above example, one class is nested in another; that is class two is nested in class one. By using scope resolution operator, the inner class member function is accessed and “Wonderful language C++” is displayed in the above program.

Test Your Skills Now!
Take a Quiz now
Reviewer Name