Let me introduce you to the concept of Inheritance in C++. Reusability is yet another important feature of C++. It is always nice if we could reuse something that already exists rather than trying to create the same all over again. It would not only save the time and money but also reduce frustration and increase readability. For instance, the reuse of a class that has already been tested, debugged and used many time can save us the effort of developing and testing the same again. Fortunately, C++ strongly supports the concept of reusability.The C++ classes can be reused in...
Tagged: multiple inheritance
Inheritance in which a derived class is derived from several base class is known as multiple inheritance. A class can inherit the attributes of two or more classes as shown in fig. below. This is known as multiple inheritance. Multiple inheritance allows us to combine the features of several existing classes as a starting point for defining new classes. It is like a child inheriting the physical features of one parent and the intelligence of another. The syntax of a derived class with multiple base class is as follows:
class D : visibility B-1, visibility B-2...
... (Body of D)
where visibility may be either public or private. The base...