Solved

difference between class inheritance and composition

Posted on 1998-11-19
2
1,136 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is a "java.lang.System Property"   ? 20 57
how do i compare an object based on two fields 6 48
Java Timer (static) 9 36
session migration servlets 2 24
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now