Posts

Showing posts from July, 2023

Inheritance and its forms

Image
  Need Of Inheritance Inheritance is a splendid concept of object oriented-languages. There are several reasons why inheritance was introduces into object oriented language. Here are some major reasons behind the introduction of inheritance. One major reason behind this is capability to express the inheritance relationship which ensures the closeness with the real-world models. Another reason is the idea of reusability . The advantages of reusability are : faster development time, easier maintenance, and easy to extend. Inheritance allows the addition of additional features to an existing class without modifying it. One can derive a new class ( subclass or   derived class ) from an existing one and add new features to it. For example, Suppose we have a class   Student, and we need to add a new class called GraduateStudent . We derive the new class G raduateStudent  from the existing class Student  and then all we need to add are the extra features to ...