rawjeev's techposts

  • Random
  • Archive
  • RSS
  • Ask me anything
Although inheritance gets a lot of emphasis while learning OOP, it doesn’t mean that you should use it everywhere you possibly can. On the contrary, you should use it sparingly, only when it’s clear that inheritance is useful. One of the clearest ways to determine whether you should use composition or inheritance is to ask whether you’ll ever need to upcast from your new class to the base class. If you must upcast, then inheritance is necessary, but if you don’t need to upcast, then you should look closely at whether you need inheritance.
Bruce Eckel (Thinking in Java, 3rd Edition)
    • #OO
    • #gyan
    • #quote
  • 2 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Recent comments

Blog comments powered by Disqus
← Previous • Next →

About

Avatar For posts that are techy / matters a little grey that I din't want to be drowning in randomness.

Home Page     Rawjeev's Randoms

Me, Elsewhere

  • @rawjeev on Twitter
  • Facebook Profile
  • raw2ube on Youtube
  • rawjeev on Flickr
  • rawjeev on Delicious
  • Linkedin Profile
  • rawjeev on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr