Inheritance is the mechanism of deriving properties of one class into another. While containership is mechanism in which one class contain objects of other classes as its member.
class alpha{_ _ _ _ _ };
class beta{_ _ _ _ _ };
class gamma
{
alpha a;
beta b;
_ _ _ _ _ };
All objects of gamma class will contain the objects a and b, this kind of relationship is called containership or nesting.
class alpha{_ _ _ _ _ };
class beta{_ _ _ _ _ };
class gamma
{
alpha a;
beta b;
_ _ _ _ _ };
All objects of gamma class will contain the objects a and b, this kind of relationship is called containership or nesting.
Comments
Post a Comment