I have the following class definitions:
class BaseHandle { };
class VertexHandle : public BaseHandle {
};
class EdgeHandle : public BaseHandle { };
class FaceHandle : public BaseHandle { };
All classes do not have virtual functions or bases.
Derived classes are made only from BaseHandleand do not add any non-static elements, not non-standard dtors.
I want to save Vertex-, Edge-and FaceHandlesin the same vector:
std::vector<BaseHandle*> handles;
But this will not work if I retrieve the object BaseHandleand want dynamic_castthem to the derived object to fail, because the classes are not polymorphic (which may be my explanation, I'm wrong).
How could I get a common vector BaseHandles? I should mention that I cannot change class definitions because they are part of a third-party library.