There is a hierarchy of classes, there is a situation in which I can not come up with a normal solution. (arrows show inheritance, red color - desired, but impossible)
Classes U , S , A , W use the same implementation of function F
And the classes SAI , AAI , WAI are different, but common to each other. This is precisely what cannot be realized as there is no possibility to create an additional class AI to implement F in it and then inherit from it. It turns out that you just have to copy the F implementation for SAI , AAI , WAI , which is bad.
What is a beautiful way to solve this problem ??
Thank!
