I have a class which I want to hold an abstract class object.
class myClass
{
abstractClass abstractObject; //won't work since abstractClass is abstract
// ....
}
where abstractClass
is an abstract base class. Then I might have a non-abstract derivedClass1
and derivedClass2
, both of which inherit from abstractClass
. I want to pass these derived class into myClass
. How do I do this using rvalues?
I want to be able to e.g. say
myClass someOBJ(derivedClass1(x, y, z));
myClass someOtherOBJ(derivedClass2(x,y,z));
and then these two objects now hold objects of type derivedClass1
and derivedClass2
.