wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Composition Vs Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Composition Vs Inheritance" Watch "Composition Vs Inheritance" New topic
Author

Composition Vs Inheritance

Balakrishna Thati
Greenhorn

Joined: Mar 12, 2008
Posts: 23
In TIJ,

During Composition 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.

Regards
Balakrishna Thati
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Hi Balakrishna! Welcome to javaranch.

I think by TIJ you mean Thinking in Java. Anyways I think this is not related to SCJP as it is more of a general Object Orientation concept which is not tested in SCJP...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Composition Vs Inheritance