Re: Array of object from varius subclasses
From: Marco (hwddtr-nospam_at_tin.it)
Date: 12/14/03
- Next message: Christof Krueger: "Design question: using malloc?"
- Previous message: John Smith: "floating point round in C++"
- In reply to: Bob Hairgrove: "Re: Array of object from varius subclasses"
- Next in thread: Max M.: "Re: Array of object from varius subclasses"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Dec 2003 23:45:56 +0100
Hi,
Thank you for all your replies and the information!
Marco
"Bob Hairgrove" <wouldnt_you_like@to_know.com> ha scritto nel messaggio
news:3fdc468e.5684383@news.webshuttle.ch...
> On Sun, 14 Dec 2003 02:08:56 +0100, "Max M." <edgar@maxim.comm2000.it>
> wrote:
>
> >Thomas Wintschel wrote:
> >
> >> Note that Max made the change from an array of CPeople to an array of
> >> CPeople*. Without this change, inserting an object of a subclasss with
a
> >> larger size would corrupt your memory.
> >
> >Tom, this sentence doesn't make much sense. One cannot *insert* an object
> >into an array. Rather, one can use the assignment operator to change an
> >element's value. Marco's original code was perfectly legal and had well
> >defined behaviour, though different from what he expected.
>
> He was referring to slicing which, although it might not "corrupt"
> memory here, will indeed cause memory leaks.
>
>
> --
> Bob Hairgrove
> NoSpamPlease@Home.com
- Next message: Christof Krueger: "Design question: using malloc?"
- Previous message: John Smith: "floating point round in C++"
- In reply to: Bob Hairgrove: "Re: Array of object from varius subclasses"
- Next in thread: Max M.: "Re: Array of object from varius subclasses"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|