I have a Visual Studio 2008 C++03 project where I would like to verify if an object is of a certain type.
For example:
int main()
{
struct A { virtual ~A() { }; };
struct B : public A { };
struct C : public A { };
A* b = new B();
A* c = new C();
assert( typeof( b ) == typeof( B ) );
assert( typeof( b ) != typeof( C ) );
assert( typeof( c ) == typeof( C ) );
assert( typeof( c ) != typeof( B ) );
assert( typeof( b ) != typeof( c ) );
return 0;
}
Is there a way to do this in C++03? How?