Multiple Inheritance
Multiple inheritance , as the name suggests , is deriving a class from more than one class . The derived class inherits all the properties of all its base classes. Consider the following example
class Aclass
{
:
:
};
class Bclass
{
:
:
};
class Cclass : public Aclass , public Bclass
{
private :
:
:
public :
Cclass(...) : Aclass (...), Bclass(...)
{
};
};
The class Cclass in the above example is derived from two classes - Aclass and Bclass - thus the first line of its class definition have the name of two classes, both publicly inherited. Like with normal inheritance , constructors have to be explained for initializing the data members of all classes. The constructor in Cclass calls constructors for base classes. The constructor calls are separated by commas.