Original Post
#include <iostream.h>
class foo
{
public:
bool isA(const type_info& type) const
{ if(typeid(this) == type)
return true;
else return false;
}
};
int main()
{ foo *myFoo = new foo();
cout << myFoo->isA(typeid(foo*)) << endl;
delete foo;
return 0;
}
|