Suppose we have an Abstract class and child (derived from abstract) classes. I know we can instantiate from derivedClass
like this:
AbstractBase *foo = new DerivedClass1();
But, is this the right way to define the top line code:
AbstractBase foo = *(new DerivedClass1());
I don't want to declare the Abstract
class via pointer. But, What is the best way to do this and manage the memeory leak?
Thanks a lot