so i do it like this:
class A{
...
Point * point1;
void setPoint(Point & point1)
}
class B{
...
Point * point1;
void setPoint(Point & point1)
}
and if i change it on class A, it will affect the point in class B?
thanks in advance :)
--- On Fri, 12/26/08, John Gaughan <[email protected]> wrote:
> From: John Gaughan <[email protected]>
> Subject: Re: [c-prog] reference object
> To: [email protected]
> Date: Friday, December 26, 2008, 8:27 PM
> Jos Timanta Tarigan wrote:
> > is it possible to hold just a reference of an object?
> for example if i want two object to keep the address of
> another object, and if one change it, the other one also
> change. What should i keep in each object?
> >
>
> You can use either a reference or a pointer.
>
> MyObject &ref = object;
> MyObject *p = &object;
>
> References are a little more robust, but less flexible. It
> really
> depends on what you need to do with it.
>
> --
> John Gaughan