This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Segfault with delete[] operator & virtually derived classes
- From: lrtaylor at micron dot com
- To: <eljay at adobe dot com>, <nathan at codesourcery dot com>, <swirlee at stickist dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 7 Mar 2005 13:00:45 -0700
- Subject: 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