View Single Post
Old May 1st, 2008, 12:08 AM   #4
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 41
Rep Power: 0 JD-Salinger is on a distinguished road
Re: copy constructors explanation and o.overloading

Quote:
Originally Posted by grumpy View Post
operator+() can be a member function of the class that accepts one argument, so "x = a + b" is effectively "x = a.operator+(b)" or a non-member, so "x = a + b" is effectively "x = operator+(a, b);".

The member function version can only accept one argument. The non-member version can only accept two.

The friend declaration within the class declares the non-member version as a friend of the class, which accepts two arguments. Removing the friend keyword makes the declaration into a member function, which is only allowed to accept one argument. However, your declaration has two .... hence the error.

The inline keyword is unrelated to your error.
wow!!!!.... c++ is really complicated... have to read more... and get some experience in real life programming....Tnx Grumpy... you are really a guru
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote