P
pmatos
Hi all,
I'm having a design problem. Imagine a Shape class that can be a
Square, a Rectangle or a Triangle. Shape should be an abstract class.
Now, I want to create a stack of Shapes.
I do
stack<Shape> shapeStack;
For some reason (probably because Shape is abstract) this is not
working, it results in a compile time error. How can I solve this
issue?
(Now, another question, if a class has at least a virtual member, does
it need to have a virtual destructor? If yes, why?)
Cheers,
Paulo Matos
I'm having a design problem. Imagine a Shape class that can be a
Square, a Rectangle or a Triangle. Shape should be an abstract class.
Now, I want to create a stack of Shapes.
I do
stack<Shape> shapeStack;
For some reason (probably because Shape is abstract) this is not
working, it results in a compile time error. How can I solve this
issue?
(Now, another question, if a class has at least a virtual member, does
it need to have a virtual destructor? If yes, why?)
Cheers,
Paulo Matos