MLUG: Re: [MLUG] C/C++ programming in Linux
Re: [MLUG] C/C++ programming in Linux
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
You can make it take two args, but then it cannot be a member function
to the class.  It has to be a friend.  This becomes important if you
need to overload an operator and the left operand is of a different
type.

-Nimrod

On Tue, Apr 02, 2002 at 09:20:05AM -0600, Ross, Matt wrote:
> > on are like
> >     point3d operator+(const point3d&, const point3d&) const;
> > and the error I'm getting from g++ is
> >     `point3d::operator+(const point3d&, const point3d&)' must take 
> > either zero or one argument
> > when I change the line to be
> >     point3d operator+(const point3d&) const;
> > everything compiles fine. My questions are, is this something 
> > I'm doing 
> > wrong, if so then what.?  
> 
> point3d operator+(const point3d&, const point3d&) 
> "must take either zero or one argument" - your giving it two args, thats why
> its fussing.  I've not done it in a while, so I don't remember how to force
> it to accept two, if you can at all.  I think you need to make a function to
> do it rather than an overloaded operator.
> --
> To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
> 
> Archives are available at http://mlug.missouri.edu/list-archives/
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/