Is there an OOP principle against a concrete class extending another concrete class?
I have read that this should be avoided, though I can't recall the source. Inheritance should used with abstrac开发者_StackOverflowt classes in the middle of the hierarchy, and concrete classes showing only as leaves.
Where can I find a good explanation of the reasoning behind this? (Opposite opinions are also welcome)
This shouldn't be taken too strictly. I think the underlying idea is more to focus on programming to an interface, either a pure interface or an abstract class, as this enables looser coupling of your design, polymorphism, encapsulation,...
Also mind to not violate the Liskov substitution principle
精彩评论