A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Programmer Certification (SCJP/OCPJP)
Composition Vs Inheritance
Joined: Mar 12, 2008
Feb 09, 2009 07:25:03
discussion, it is mentioned that
In composition, you can change the member objects @ runtime, to dynamically change the behaviour of the program.
Inheritance does not have this flexibility since compiler must place compile time restrictions on classes created with inheritance.
I doesn't understand this concept.
Can any one give an example code illustration this.
Joined: Aug 03, 2008
Feb 09, 2009 07:46:29
Hi Balakrishna! Welcome to javaranch.
I think by TIJ you mean Thinking in Java. Anyways I think this is not related to
as it is more of a general Object Orientation concept which is not tested in SCJP...
SCJP 6 | SCWCD 5 |
Javaranch SCJP FAQ
I agree. Here's the link:
subject: Composition Vs Inheritance
exam Query : class relationships
Regarding inheritance and composition
Composition versus Inheritance
Inheritance or composition?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014