Reusability In OOP

  In OOP, The concept of inheritance provide the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes. The real appeal and power of the inheritance mechanism is that it allows the programmer to reuse a class that is almost, but not exactly, what he wants, and to tailor the class in such a way that it does not introduce any undesirable side effects into the rest of the classes. 

Fig.5 : Property inheritance

Note that each sub class defines only those features that are unique to it. Without the use of classification, each class would have to explicitly include all of its features.

Comments

Post a Comment

Popular posts from this blog

Encapsulation and Data Abstraction In OOP

Polymorphism ,operator overloading,function overloading,dynamic binding