Inheritance

 Inheritance: 

Inheritance may be defined as the process by which we can use the properties and behavior of parent class. In Inheritance we make the two classes one is child class and other one is parent class. Child class inherits all the elements of parent class.

 

Advantages of inheritance:

• In inheritance the code to be reused as many times as needed.
• It helps to Setting up a protocol
• The base class once defined and once it is compiled, it need not be reworked
• Saves time and effort as the main code need not be written again.
• Reusability of code
• Reduces development time.

Disadvantages of inheritance:

• Increase program complexity
• Improper utilization of memory
• Extra time is needed for understanding classes library
• Compiler overheads
• Proper understanding of hierarchy

 

Different types of Inheritance:

1)Single level inheritance
2)Multi level inheritance
3)Multiple inheritance
4)Hierarchical inheritance
5)Hybrid inheritance

 

Leave a Reply

Your email address will not be published. Required fields are marked *