I was reading the book “Design Patterns. Elements of Reusable Object-Oriented Software” and find this statement very interesting:
Because inheritance exposes a subclass to details of its parent’s implementation, it’s often said that “inheritance breaks encapsulation”.
Would be this true even if all the members of a superclass are private? With the exception of its interface, of course.
Another question: if inheritance would break encapsulation anyway, even if the subclass could only see the interface of its superclass, how would alternative methods to inheritance, like delegation, not break it?