Is there anyway to do a type of "stacking inheritance" where you replace potentially multiple functions of a base class based on other calls?
for example something like:
class Base {
void func1(){/* do something */}
void func2(){/* do something */}
};
class A1 {
void func1(){/* do something else */}
};
class A2 {
void func2(){/* do something else */}
};
int main(){
A1 a1obj = new A1();
A2 a2obj = new A2();
Base obj = new Base();
obj = &a1obj;
obj = &a2obj;
obj.func1(); //now A1::func1()
obj.func2(); //now A2::func2()
}
Thank you