This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: typeid() headaches (library to main executable)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]