RE: Segfault with delete[] operator & virtually derived classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Eljay Love-Jensen
Sent: Monday, March 07, 2005 11:43 AM
To: lrtaylor; nathan@xxxxxxxxxxxxxxxx; swirlee@xxxxxxxxxxxx
Cc: gcc-help@xxxxxxxxxxx
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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux