Given the class and subclass:
class Event {...} class Note : public Event {...}
The note is cloned and stored in the pointer inside the f () function. Typical information is stored in a pointer and can be restored by dynamic_cast:
void f() { pEvent = pNote->Clone();
Now, after returning from f (), type information is lost:
f(); ASSERT(dynamic_cast<Note*>(pEvent));
VS-debugger shows the actual value of the pointer (unchanged), but not a derived class, except that it is in f() -scope.
How to lose RTTI-info for a pointer when returning from a function?
source share