Multiple inheritance refers to a feature of some object-oriented programming languages in which a class can inherit behaviors and features from more than one superclass. This contrasts with single inheritance, where a class may inherit from at most one superclass.
Multiple inheritance allows a class to take on functionality from multiple other classes, such as allowing a class named StreetMusician
to inherit from a class named Human
, a class named Musician
, and a class named Worker
. This can be abbreviated StreetMusician : Human, Musician, Worker
.
Ambiguities arise in multiple inheritance, as in the example above, if for instance the class Musician inherited from Human
and Worker
and the class Worker
inherited from Human
. This is referred to as the Diamond problem. There would then be the following rules:
Worker : Human----------------------------------------------------------------------------------------------
Musician : Human, Worker
StreetMusician : Human, Musician, Worker
A C++ PROGRAM TO IMPLEMENT MULTIPLE INHERITANCE
COMPILER EMPLOYED: DEV C++ COMPILER-4.9.9.2
SOURCE FILE SIZE :3 kb
EXE FILE SIZE :580 kb
NOTE: PLEASE INCLUDE THE DESIRED HEADER FILE
---------------------------------------------------------------------------------------------
C++ PROGRAM SOURCE & EXE DOWNLOAD:
Click download button to download
DISCLAIMER: The following program cannot be ensured of perfection.so any flaws in the program can be notified in the comments section.
----------------------------------------------------------------------------------------------
Your's friendly,[MOHANRAM.G],
ADMIN...
0 comments:
Post a Comment