< Prev
Next >

Multiple Inheritance in C++

In our previous article, we introduced you to one of the types of inheritance - single inheritance. Today we are going to discuss the first type of inheritance in C++ named - multiple inheritance. Multiple inhertance is performed when a class inherits the features of multiple classes(more than one class at a time).

The class that wants to use the features of another class is called subclass or derived class, whereas the classes whose features are to be used/inherited is referred to as base classes.

What features a subclass inherits from its base class, through inheritance?

Note - Base class members marked with private visibility mode are never inherited.

Rules of inheritance -

Depending on the value of visibility-mode, multiple inheritance can be performed in various ways -

Syntax of Multiple Inheritance

Let us take a look at the syntax of performing multiple inheritance, using which we could define a derived class which is inheriting multiple base classes.

class derived-class-name : visibility-mode base-class-name1, visibility-mode base-class-name2...
//members of derived class

Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next