Advertisements
Advertisements
प्रश्न
Explain different types of inheritance with suitable diagram.
Explain any three type of inheritance with suitable diagram.
स्पष्ट करा
Advertisements
उत्तर
- The mechanism of deriving a new class from an old one is called inheritance. The old class is referred to as the base class, and the new class is referred to as the derived class. C++ strongly supports the concept of reusability. This is basically done by creating new classes and reusing the properties of the existing ones. Functions and variables of a class that has been tested can be used by an object of another class. This is known as inheritance. Reusing a class that has already been tested, debugged, and used many times can save the effort of redeveloping and retesting it.
- One of the most useful features of classes is inheritance. It is possible to declare a class that inherits the properties of another class or classes. This means that, with good class design, you can build applications based on proven reusable code. i.e., the main purpose of inheritance is code reusability.
Different forms of Inheritance:
- Single inheritance

- Multiple Inheritance

- Hierarchical Inheritance

- Multilevel Inheritance

- Hybrid Inheritance

shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
