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.

6
  • If you inherit from a base class, you also gain access to any non-overrided methods in that class. This is fundamentally different than the other two solutions. It's not semantics at all. The different approaches fulfill vastly different purposes. Commented Feb 12, 2014 at 14:51
  • Inheriting just to gain access is not a good design guideline. I reaffirm myself, it's mainly semantics. Commented Feb 12, 2014 at 14:54
  • 1
    Yes, but you can do MORE than just "gain access" via inheritance. Just because this particular example doesn't demonstrate that doesn't mean that it isn't an available possibility. You CANNOT define functionality via an interface, ergo the two processes are NOT identical, and calling them essentially the same is misleading. Commented Feb 12, 2014 at 14:57
  • Well, that's true. I wasn't thinking on additional methods you inherit from an hipothetic base class, only on those defined in the final class. Thanks @Roger for pointing this out :) Commented Feb 12, 2014 at 15:00
  • 1
    Don't think on efficiency here, for it is dangerous from the point of view of design. Simply use base classes and interfaces, each in those situations for which they're suitable. Commented Feb 12, 2014 at 16:50