Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 2
    Umm, what? This isn't very clear. Commented Mar 13, 2014 at 16:45
  • Writing base classes is what polymorphism is all about. Commented Mar 13, 2014 at 17:14
  • I guess what bugs me is the case where I need to inherit a class and there is already a base class. I have to then create a parent to inherit the original base. This seems like cruft to me. Just wondering if given the opportunity whether you should always prefer an interface if you're writing the initial code. Commented Mar 13, 2014 at 19:12
  • @RobbieDee: It very much depends on what you're doing. Just because you're designing a breed of Horse with green fur does not mean it should inherit from Tree. Both might have LeafGreenBrushs, though. You have to be very careful deciding what gets inherited. Think carefully about whether something really needs to inherit from a second parent. If the class is well designed and does one thing, it probably doesn't need to. Commented Mar 13, 2014 at 19:50
  • OK, I've added an example by way of clarification Commented Mar 13, 2014 at 22:26