Containership in C++





Containership in C++

                When a class contains objects of another class or its members, this kind of relationship is called containership or nesting and the class which contains objects of another class as its members is called as container class.

Syntax for the declaration of another class is:

 

Class class_name1

{

——–

——–

};

Class class_name2

{

——–

———

};

Class class_name3

{

Class_name1 obj1;                   // object of class_name1

Class_name2 obj2;                 // object of class_name2

———-

———–

};



Related posts:

  1. Derivation in C++ Types of derivation Inheritance is a process of creating a...
  2. Class In C++ Class in c++ Class is a group of similar object....
  3. Object oriented programming Object oriented programming : The main idea behind object oriented...
  4. Access Specifier In C++ Access specifier A key feature of object oriented programming is...
  5. Constructor in C++ Constructor in C++ Constructor is a member function with the...