![]() Polymorphism is an important OOP concept it means the ability to take many forms. The code below illustrates an example of Inheritance. In Java, the derived class is also known as the subclass. The new class consists of the combined features from both the classes. It means that we can add additional features to parent class without modification this is possible by deriving a new class from the parent class. In OOP, the idea of inheritance provides the concept of reusability. The principle behind this division is that each subclass shares common characteristics from the class from its parent class. For Example, a bird Robin is part of the class, not a mammal, which is again a part of the class Animal. Inheritance supports the concept of hierarchical classification. Inheritance is the process by which objects of one class acquire some properties of objects of another class. ![]() The code below shows an example of abstraction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |