DEV Community

Gilbert Ngeno
Gilbert Ngeno

Posted on

Inhertitance breaks encapsulation

1

I have seen many articles where it says inheritance breaks encapsulation

http://igstan.ro/posts/2011-09-09-how-inheritance-violates-encapsulation.html

But I am unable to understand the concept behind it. in the given example

Can anyone please explain how composition is avoiding this problem

Top comments (0)