I would like to write a class X (this) that inherits from A (the base) can
execute methods B (?) and must implement elements of C (interface).
Implementing A and C is not a problem. But since X cannot be deduced from several classes, it seems that X does not inherit the logic of A and B. Note that A is a very important base class, and B is almost an interface, but contains executable behavior. The reason I don't want B to be an interface is because the behavior is the same for every class that inherits or implements it.
Do I really have to declare B as an interface and implement the same 10 lines of code for each X that requires the behavior of B?
2 months later
I am currently studying C ++ for use in UE4 (Unreal Engine 4).
Since C ++ is much less strict than C #, it actually contains the term pattern idom implementation that describes this behavior: they are called mixin s.
You can read the paragraph on C ++ mixing here on page 9 (second paragraph).
source share