Search code examples
oopcomputer-science

Can inheritance in OOP cause problems?


In OOP there is no way of removing the inherited elements such as a method or a variable from a super class. I am wondering is this a strenght or a weakness of the OOP? There is certainly a lot of benefits you get from this approach, but can this also cause any problems/issues such as security, performance etc?


Solution

  • In a language such as C++, SUPER methods/properties can be private meaning they are not inherited, and for best practice, variables in a super should all be private and accessed through publicly derived access methods anyway