typeid() headaches (library to main executable)

Eljay Love-Jensen eljay@adobe.com
Wed Apr 27 15:17:00 GMT 2005


Hi Andreas,

I think the problem you are running into is because you have...

CBaseTestClass* pClass;

...but you are not setting to the pointer to a valid object.  It's just a random garbage value.

If you change your code to this...

CBaseTestClass* pClass = new CBaseTestClass;

...your code should work.  (It worked for me.  I also removed all your inlines, and made them non-inline in the program.cpp file, and put in virtual destructors for both classes.)

HTH,
--Eljay



More information about the Gcc-help mailing list