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: Segfault with delete[] operator & virtually derived classes


Yes, I didn't think things through enough before responding.  However, I
think my example was not taken the way I intended...  No biggy.  I
should have just kept my mouth shut anyway.  :-)

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Eljay Love-Jensen
Sent: Monday, March 07, 2005 11:43 AM
To: lrtaylor; nathan@codesourcery.com; swirlee@stickist.com
Cc: gcc-help@gcc.gnu.org
Subject: RE: Segfault with delete[] operator & virtually derived classes

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




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