On 5/3/07, duongthaiha <[EMAIL PROTECTED]> wrote:

> Hi sorry for a new bee question. I have the following code but there
> is something that i can not understand what does it do.
>
> Can you please tell me what does "Point &operator=( Point p)" does?
>
> I think that the a overwrite the = operator but should it return bool
> instead of Point??

Yes, it overloads the = operator (assignment), and returning a
reference to an object of class Point is correct. == (equality) is
what you would want to use to return a boolean.


> Thanks a lot in advance.
>
> Best regard
>
>
> class Point {
>     public:
>         double x;
>         double y;
>         double z;
>         double thickness;
>
>         Point(double xx=0,double yy=0,double zz=0,double tn=0){
>               x=xx;
>               y=yy;
>               z=zz;
>               thickness=tn;
>     }
>
>     Point(const Point& obj){
>                 x=obj.x;
>                 y=obj.y;
>                 z=obj.z;
>                 thickness=obj.thickness;
>     }
>
>         Point &operator=( Point p) { // Right side is the argument.
>               x=p.x;
>               y=p.y;
>               z=p.z;
>               thickness=p.thickness;
>     }
> };
>
>
>
> To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
> Yahoo! Groups Links
>
>
>
>


-- 
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to