Skip to main content

Posts

Showing posts from March, 2021

INHERITENCE

C++  IN  INHERITENCE                          In C++, inheritance is a process in which one object acquires all the properties and behaviors of its parent object automatically. In such way, you can reuse, extend or modify the attributes and behaviors which are defined in other class.                In C++, the class which inherits the members of another class is called derived class and the class whose members are inherited is called base class. The derived class is the specialized class for the base class. ADVANTAGE OF C++ INHERITANCE;                        CODE REUSABILITY:   Now you can reuse the members of your parent class. So, there is no need to define the member again. So less code is required in the class. TYPES OF INHERTANCE; C++ supports five types of inheritance: Single inheritance Multiple inheritance Hierarchical inheritance Multilevel inheritance Hybrid inheritance DERIVED CLASSES;                     A Derived class is defined as the class derived from the base class.