When designing a game, a question arose. Suppose there is an IUnit interface and it is implemented by all the classes that describe the units. But for these classes, some of the code may be the same, therefore, or you will have to duplicate the code, which simply contradicts the purpose of the functions, or add default behavior.
I decided to do this: the interface remains, but the abstract UnitBase class is UnitBase , which implements the default behavior for some methods, and already classes describing the units either explicitly implement the interface if they are not at all like UnitBase or inherit UnitBase to avoid code duplication.
However, there is an opinion that inheritance breaks encapsulation, therefore inheriting an abstract class is bad and my approach is unsuitable. Is this true and how this architecture corresponds to the canons of the PLO?