Thursday, January 24, 2013

Inheritance vs Composition

Inheritance lets us to leverage Dynamic binding and code reuse.
Composition lets us make use of the delegation, it happens like this, the caller can always call the front end class,it in turn calls the backed class. The advantage of composition is it provides stronger encapsulation compared to inheritance( we do not need to make any changes to the call, if the back end class's signature/return type changes.

1 comment:

  1. can you remove your blog name, if you are not using... because I want to make a website with javasimplified.blogspot.com name... please its a request to you.. you can contact me on javasimplify.blogspot.com

    ReplyDelete