I have the following hierarchy:
class base
{
public:
virtual ~base(){}
virtual void foo() {}
};
template
class derived1 : public base
{
You could add a virtual method to do a meta-type check of some kind:
class base
{
public:
~base(){}
virtual void foo() {}
virtual bool isa(const char* type_to_test){
return strcmp(type_to_test,"base")==0;}
};
template
class derived1 : public base
{
virtual void foo() {};
virtual bool isa(const char* type_to_test){
return strcmp(type_to_test,"derived1")==0;}
};