This have been asked in the interview.
How to write own dynamic_cast. I think, on the basis of typeid\'s name function.
Now how to implement own typid? I hav
To attempt an answer slightly less routine, if slightly less defined:
What you need to do is cast the pointer to an int*, create a new type T on the stack, cast a pointer to it to int*, and compare the first int in both types. This will do a vtable address comparison. If they are the same type, they will have the same vtable. Else, they don't.
The more sensible of us just stick an integral constant in our classes.