Check type of subclass

 

Hi,

I have a class that holds a dynamic array of pointers to types of subclass of another base class.
It has a method that accepts a reference to a certain type of the subclass and I need to know if 
it already has a saved pointer to that type of subclass.

Is there a way doing it by the pointer type and without adding a type property to each subclass?

 
Since up casting to an improper type aborts the EA, and MT4 doesn't have any dynamic cast or RTTI, I implemented my own.
class B : public Polymorphic{ POLYMORPHIC(Polymorphic);
 ... };  // B
class D : public B{ POLYMORPHIC(B); //<< Base bracket P() is private.
... };   // D
class E : public B{
     POLYMORPHIC(B);                //<< Base over Base shows names match.
 public:
... };   // E
:
   B* bp = new D();
   D* dp; if(bp.dynamic_cast(dp)){     // bp is a D and returns true.
   E* ep; if(bp.dynamic_cast(dp)){     // bp is not a E and returns false.
Files:
Reason: