Solved

difference between class inheritance and composition

Posted on 1998-11-19
2
1,143 Views
Last Modified: 2008-02-20
what is the different between class Inheritance and composistion ? and When would I choose the former over the later ?
0
Comment
Question by:anhben
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1227860
The following book has an entire chapter (very well written too) dedicated to this subject:

Java Design : Building Better Apps and Applets (Yourdon Press Computing Series), 1st Edition by Peter Coad, Mark Mayfield, Pete Coad

It gives you the rules on when to use inheritance and when to use composition instead.
0
 
LVL 5

Accepted Solution

by:
fontaine earned 50 total points
ID: 1227861
In the November issue of the Javaworld on-line magazine, there is a 2500 words article
entitled...

"Inheritance versus composition: Which one should you choose? "

This is exacly what you need! Here is the URL:

http://www.javaworld.com/javaworld/jw-11-1998/jw-11-techniques.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question