Can someone please tell me if this sort of thing is possible:
I have three classes, A, B, C. and I have a fourth, class D, that inherits any one of A, B or C. Is it possible to dynamically pick which one to inherit from without using the strategy (or bridge) patterns:
For example:
Then later, dynamically have the base class chosen for me by setting what the someCondition variable is set to.Code:template <class T = someCondition ? A : B> class D; class C {...}; class B {...}; class A {...}; template <class T> class D : public T { ... };
Is this sort of thing possible? Or is there a better way of auto-picking the base class of a template WITHOUT manually specifying the template parameters?Code:A<> i;