On Sun, 2 Jun 2002 at 09:21:54 -0700, "Mark Wilden" <[EMAIL PROTECTED]> wrote: >From: "Richard Coutts" <[EMAIL PROTECTED]> > > > > SubClass* sc = >(SubClass*)MemHandleLock(MemHandleNew(sizeof(SubClass))); > >This doesn't create an instance of _any_ class. It just creates an >uninitialized hunk of memory that happens to be the same size as >an instance >of SubClass. But it's not a SubClass object, so it isn't >initialized to >point to SubClass's virtual function table, so a call to any virtual >function will (fortunately) fail. > >Use operator new to create class instances.
Strictly speaking, just "new". Like this: SubClass* sc = new SubClass; BaseClass* bc = sc; bc->setVal(); -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
