Segfault with delete[] operator & virtually derived classes

Eljay Love-Jensen eljay@adobe.com
Mon Mar 7 20:01:00 GMT 2005


Hi Lyle,

 >am I lying to the compiler?  That's what inheritance and polymorphism is 
all about!

In what way do you have a polymorphic ARRAY?

In what way does your ARRAY use inheritance?

You have an array of polymorphic objects.  The ARRAY is not polymorphic.

Use std::vector<A*> to create an array of polymorphic objects.  (Use BOOST 
if you want managed pointers too.)

HTH,
--Eljay



More information about the Gcc-help mailing list