Inheritance vs. Composition...
Shutdown :: Technical Discussions :: Need Help! :: OOAD
Page 1 of 1
Inheritance vs. Composition...
Hi All,
One of the core concepts in OO Programming is inheritance wherein we try to abstract out the common portions of different types of classes and put it into a parent class. The corresponding method behaviours that change are then overridden in the child classes in order to implement specific behaviour. But is inheritance the best option always?
What is composition and how does it win over inheritance?
HINTS:
1) What if we have to change a single method in all the subclasses at a later point of time? This will change the system a lot.
2) Think about interfaces.
Regards,
Lester.
One of the core concepts in OO Programming is inheritance wherein we try to abstract out the common portions of different types of classes and put it into a parent class. The corresponding method behaviours that change are then overridden in the child classes in order to implement specific behaviour. But is inheritance the best option always?
What is composition and how does it win over inheritance?
HINTS:
1) What if we have to change a single method in all the subclasses at a later point of time? This will change the system a lot.
2) Think about interfaces.
Regards,
Lester.
lester.noronha- VIP Member
- Number of posts : 54
Registration date : 2008-04-29
Shutdown :: Technical Discussions :: Need Help! :: OOAD
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|