Re: illegel indirecion
From: Ron Samuel Klatchko (moocat94122_at_yahoo.com)
Date: 06/16/04
- Next message: Rajeev Ayyagari: "Re: Java's performance far better that optimized C++"
- Previous message: Robin Sanderson: "Re: argv/pointer problems"
- In reply to: Karl Heinz Buchegger: "Re: illegel indirecion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Jun 2004 14:32:10 -0700
Karl Heinz Buchegger <kbuchegg@gascad.at> wrote in message news:<40D05312.53200D17@gascad.at>...
> JKop wrote:
> >
> > MiKy posted:
> >
> > > I am getting this error:
> > > Illegal indirection at line : a[*count_circle].SetArea(p1);
> > > Is it possible to set an object in an array like I am trying to do ?
> > >
> > > void CreateCircle(Circle* a, int count_circle)
> > > {
> >
> > I can only presume that a points to the start of an array of Circle*.
>
> ... then the first argument to this function would be of type Circle**.
> Since it is not you can deduce that a does not point to the start of an array
> of Circle*
A Circle* can most definitely point to an array of Circles. A Circle**
will actually point to an array of pointers to circles. Since you have
an array of pointers, you can then actually have any object derived from
Circle to enable you to get polymorphic behaviour.
But if all you have are actual circles, an array of actual instances of
Circles would be represented by Circle*.
samuel
- Next message: Rajeev Ayyagari: "Re: Java's performance far better that optimized C++"
- Previous message: Robin Sanderson: "Re: argv/pointer problems"
- In reply to: Karl Heinz Buchegger: "Re: illegel indirecion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|