What is containership or nesting of classes in Cpp?

All QuestionsCategory: Cpp LanguageWhat is containership or nesting of classes in Cpp?
Chetan Shidling Staff asked 5 years ago

I need short information.

1 Answers
Chetan Shidling Staff answered 5 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.