![]() It is a key point to note that you can easily identify the IS-A relationship. For example, Apple is a Fruit, Car is a Vehicle etc. It is just like saying "A is a B type of thing". In object-oriented programming, the concept of IS-A is a totally based on Inheritance, which can be of two types Class Inheritance or Interface Inheritance. Although the compiler and Java virtual machine (JVM) will do a lot of work for you when you use inheritance, you can also get at the functionality of inheritance when you use composition. There are two ways we can do code reuse either by the vimplementation of inheritance (IS-A relationship), or object composition (HAS-A relationship). One of the advantages of an Object-Oriented programming language is code reuse.
0 Comments
Leave a Reply. |