![if !IE]> <![endif]>
Ø A class that contains the definition of another class called nesting class and the class inside the nesting class called nested class.
Ø The nesting class can access the data member and function member of a nested class.
Ø Nested classes can directly use names, type names, names of static members, and enumerators only from the enclosing class. To use names of other class members, you must use pointers, references, or object names.
Ø The nesting of classes enables building of powerful data structures.
Data Members of Nesting Class;
Data Member of Nested Class
Function Members of Nested Class
class fxclg //Nesting Class
class cse //Nested Class
cout<<"Enter Details Name Age Dept:\n";
fxclg::cse cs1; //Declaring Object for Nested Class cs1.get();
Enter Details Name Age Dept:
name kumar age: 24 dept: CSE
In this example, the class cse (nested class) is defined within the class fxclg(nesting class),To declare the objects of a nested class we have to follow the procedure, fxclg::cse c1; Using this object it access the data and function member of nested class cse
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.