Hello, I am creating a class library with many different options for possible customizations. For example, you can design your class so that it can perform FeatureX(), or you can design your class so that it can perform FeatureY().
Under normal circumstances, you would simply create an interface IFeatureX with a pure virtual method called FeatureX, and another interface IFeatureY with a pure virtual method called FeatureY. If a class has both FeatureX and FeatureY, it can inherit from both, no problem.
My problem is, what if a function/method requires an object that can perform both FeatureX() and FeatureY()? How do I express a type, in C++ preferably, but an answer in Java could help as well, to ensure that both FeatureX and FeatureY are available?
Do I create another interface IFeatureXY that inherits from IFeatureX and IFeatureY? Okay... if there are only two features I could get away with this. But if there are say... 10 features, the number of possible interfaces becomes massive.
Is there a simple way to do this? I tried solving the problem using C++ templates and delegation but didn't get too far. I'm hoping there is a simple solution to this, and there probably is one that I just overlooked.
I appreciate any help and advice you guys have.
Thanks.