Wednesday, August 18, 2010

Inheritance versus composition: Which one should you choose?

 

One of the fundamental activities of an object-oriented design is establishing relationships between classes. Two fundamental ways to relate classes areinheritance and composition. 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. This article will compare these two approaches to relating classes and will provide guidelines on their use. more info

No comments:

Post a Comment