Computer Science, asked by fardinrocky, 6 months ago

Write a C++ program that can multiply three integer numbers using multiple inheritance.

Answers

Answered by daivikdalwadi10
1

Though but multiple and multilevel sounds like same but they differ hugely in meaning. In multilevel inheritance, we have multiple parent classes whereas in in multiple inheritance we have multiple base classes.

To put it in simple words, in multilevel inheritance, a class is derived from a class which is also derived from another base class. And these levels of inheritance can be extended. On the contrary, in multiple inheritance, a class is derived from two different base classes.

For example

Multilevel inheritance : Inheritance of characters by a child from father and father inheriting characters from his father (grandfather)

Multiple inheritance : Inheritance of characters by a child from mother and father

C++ Multiple Inheritance Block Diagram

Following block diagram highlights its structure.

As shown in above block diagram, class C is derived from two base classes A and B.

As in other inheritance, based on the visibility mode used or access specifier used while deriving, the properties of the base class are derived. Access specifier can be private, protected or public.

Click here to learn in detail about access specifiers and their use in inheritance

Similar questions