Hierarchical Inheritance in C++
C++ Hierarchical Inheritance When several classes are derived from common base class it is called hierarchical inheritance . In C++ hierarchical inheritance , the feature of the base class is inherited onto more than one sub-class. For example, a car is a common class from which Audi, Ferrari, Maruti etc can be derived. Following block diagram highlights its concept. Hierarchical Inheritance Block Diagram As shown in above block diagram, in C++ hierarchical inheritance all the derived classes have common base class. The base class includes all the features that are common to derived classes. 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 C++ Hierarchical Inheritance Syntax class A // base cl
Comments
Post a Comment