I think I am misunderstanding something with the C++ inheritance.
Let's say I have this classical inheritance :
class A{
public:
virtual void method1() =0;
virtual ~A() = default;
}
class B : public A{
public :
void method1(){doSomething();}
}
class C : public A{
public :
void method1(){doSomethingElse();}
}
How do I make an other Class Q own an object of type B or C without knowing in advance which type it is ? (I mean we know it is type A that's all)
Thanks for reading !