Multiple inheritances
In multiple inheritances, we have two or more base classes and a single derived class. The single derived class inherits the properties of all the base classes.
Classes “A” ,”B” and “C” are the base classes and class “D” is the derived class. Class “D” inherits the properties of the classes “A” , “B” and “C”.
The syntax for defining a base class and derived class
//base class
class classA
{
private:
Variables/methods;
protected:
Variables/methods;
public:
Variables/methods;
};
//base class
class classB
{
private:
Variables/methods;
protected:
Variables/methods;
public:
Variables/methods;
};
//derived class
class classC : private/protected/public classA, private/protected/public classB
{
private:
Variables/methods;
protected:
Variables/methods;
public:
Variables/methods;
};