Shutdown
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Inheritance vs. Composition...

Go down

Inheritance vs. Composition... Empty Inheritance vs. Composition...

Post  lester.noronha Fri May 09, 2008 5:09 pm

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.
lester.noronha
lester.noronha
VIP Member
VIP Member

Number of posts : 54
Registration date : 2008-04-29

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum