What is containership or nesting of classes in Cpp?


Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
All QuestionsCategory: Cpp LanguageWhat is containership or nesting of classes in Cpp?
Chetan Shidling Staff asked 6 years ago

I need short information.

1 Answers
Chetan Shidling Staff answered 6 years ago

Nesting of classes in Cpp

  1. C++ supports another way of inheriting the properties of one class into another.
  2. Here the class can contain objects of other classes as its members.

Example:

class alpha {   }
class beta {   }
class gamma
{
alpha a;
beta b;
……
};
This kind of relationship is called containership or nesting.