I am writing an expression-parsing library.
It is written with Qt, and I have a class structure like this:
QCExpressionNode-Abstract Base Class for all pieces of an expression
QCConstantNode-Constants in an expression (extends QCExpressionNode)
QCVariableNode-Variables in an expression (extends QCExpressionNode)
QCBinaryOperatorNode-Binary Addition, Subtraction, Multiplication, Division and Power operators (extends QCExpressionNode)
I would like to be able to use smart pointers (like QPointer or QSharedPointer), but I am running into the following challenges:
-Can a QPointer be used with abstract classes? If so, please provide examples.
-How to cast a QPointer to a concrete subclass?