In C++ you can declare a pointer as one type, and then point it towards a different, inheriting type instead. Is there any way to tell which you're currently pointing at?
#include <typeinfo>
using namespace std;
class Foo
{
};
class Bar : public Foo
{
};
int main()
{
Bar bar;
Foo* foo = &bar;
bool I_WANT_THIS_TO_BE_TRUE = (typeid(*foo) == typeid(Bar));
return 0;
}