4 ms·
> All OOP languages have it, the issue is related to changing the behaviour of the base class, and the change introducing unforceen consequences on the inherita
by leni536 2y ago
> All OOP languages have it, the issue is related to changing the behaviour of the base class, and the change introducing unforceen consequences on the inheritance tree.
C++ largely solves it by having tight encapsulation. As long as you don't change anything that breaks your existing interface, you should be good. And your interface is opt-in, including public members and virtual functions.
- pjmlp 2y agoNot when you change the contents of the class itself for public and protected inheritance members, which is exactly the whole issue of fragile base class. It doesn't go away just because private members exist as possible language feature.
- leni536 2y agoThat's not a fragile base, that's just a fragile class. You can break APIs for all kinds of users, including derived classes. Some APIs are aimed towards derived classes, like protected members and virtual functions, but that doesn't make the issue fundamentally different. It's just breaking APIs. Point is, in C++ you have to opt-in to make these API surfaces, they are not the default.
- pjmlp 2y agoI give up, word games to avoid acknowledging the same happens.