J
Jim Michaels
friend fraction& operator+=(const fraction& rhs);
fraction.h(64) Error: error: 'fraction& operator+=(const fraction&)'
must take exactly two arguments
I practically pulled this out of a C++ book (except for the "friend").
can someone explain why GCC is giving me problems here?
for a += or similar operator, what does a proper declaration look like
and what are its arguments for?
fraction.h:64: error: 'fraction& operator+=(const fraction&)' must take
exactly two arguments
fraction.h:65: error: 'fraction& operator+=(const char*)' must have an
argument of class or enumerated type
fraction.h:65: error: 'fraction& operator+=(const char*)' must take
exactly two arguments
fraction.h:66: error: 'fraction& operator+=(const long int&)' must have
an argument of class or enumerated type
fraction.h:66: error: 'fraction& operator+=(const long int&)' must take
exactly two arguments
fraction.h:72: error: 'fraction& operator-=(const fraction&)' must take
exactly two arguments
fraction.h:73: error: 'fraction& operator-=(const char*)' must have an
argument of class or enumerated type
fraction.h:73: error: 'fraction& operator-=(const char*)' must take
exactly two arguments
fraction.h:74: error: 'fraction& operator-=(const long int&)' must have
an argument of class or enumerated type
fraction.h:74: error: 'fraction& operator-=(const long int&)' must take
exactly two arguments
fraction.h:80: error: 'fraction& operator*=(const fraction&)' must take
exactly two arguments
fraction.h:81: error: 'fraction& operator*=(const char*)' must have an
argument of class or enumerated type
fraction.h:81: error: 'fraction& operator*=(const char*)' must take
exactly two arguments
fraction.h:82: error: 'fraction& operator*=(const long int&)' must have
an argument of class or enumerated type
fraction.h:82: error: 'fraction& operator*=(const long int&)' must take
exactly two arguments
fraction.h:88: error: 'fraction& operator/=(const fraction&)' must take
exactly two arguments
fraction.h:89: error: 'fraction& operator/=(const char*)' must have an
argument of class or enumerated type
fraction.h:89: error: 'fraction& operator/=(const char*)' must take
exactly two arguments
fraction.h:90: error: 'fraction& operator/=(const long int&)' must have
an argument of class or enumerated type
fraction.h:90: error: 'fraction& operator/=(const long int&)' must take
exactly two arguments
fraction.h:96: error: 'fraction& operator%=(const fraction&)' must take
exactly two arguments
fraction.h:97: error: 'fraction& operator%=(const char*)' must have an
argument of class or enumerated type
fraction.h:97: error: 'fraction& operator%=(const char*)' must take
exactly two arguments
fraction.h:98: error: 'fraction& operator%=(const long int&)' must have
an argument of class or enumerated type
fraction.h:98: error: 'fraction& operator%=(const long int&)' must take
exactly two arguments
fraction.h(64) Error: error: 'fraction& operator+=(const fraction&)'
must take exactly two arguments
I practically pulled this out of a C++ book (except for the "friend").
can someone explain why GCC is giving me problems here?
for a += or similar operator, what does a proper declaration look like
and what are its arguments for?
fraction.h:64: error: 'fraction& operator+=(const fraction&)' must take
exactly two arguments
fraction.h:65: error: 'fraction& operator+=(const char*)' must have an
argument of class or enumerated type
fraction.h:65: error: 'fraction& operator+=(const char*)' must take
exactly two arguments
fraction.h:66: error: 'fraction& operator+=(const long int&)' must have
an argument of class or enumerated type
fraction.h:66: error: 'fraction& operator+=(const long int&)' must take
exactly two arguments
fraction.h:72: error: 'fraction& operator-=(const fraction&)' must take
exactly two arguments
fraction.h:73: error: 'fraction& operator-=(const char*)' must have an
argument of class or enumerated type
fraction.h:73: error: 'fraction& operator-=(const char*)' must take
exactly two arguments
fraction.h:74: error: 'fraction& operator-=(const long int&)' must have
an argument of class or enumerated type
fraction.h:74: error: 'fraction& operator-=(const long int&)' must take
exactly two arguments
fraction.h:80: error: 'fraction& operator*=(const fraction&)' must take
exactly two arguments
fraction.h:81: error: 'fraction& operator*=(const char*)' must have an
argument of class or enumerated type
fraction.h:81: error: 'fraction& operator*=(const char*)' must take
exactly two arguments
fraction.h:82: error: 'fraction& operator*=(const long int&)' must have
an argument of class or enumerated type
fraction.h:82: error: 'fraction& operator*=(const long int&)' must take
exactly two arguments
fraction.h:88: error: 'fraction& operator/=(const fraction&)' must take
exactly two arguments
fraction.h:89: error: 'fraction& operator/=(const char*)' must have an
argument of class or enumerated type
fraction.h:89: error: 'fraction& operator/=(const char*)' must take
exactly two arguments
fraction.h:90: error: 'fraction& operator/=(const long int&)' must have
an argument of class or enumerated type
fraction.h:90: error: 'fraction& operator/=(const long int&)' must take
exactly two arguments
fraction.h:96: error: 'fraction& operator%=(const fraction&)' must take
exactly two arguments
fraction.h:97: error: 'fraction& operator%=(const char*)' must have an
argument of class or enumerated type
fraction.h:97: error: 'fraction& operator%=(const char*)' must take
exactly two arguments
fraction.h:98: error: 'fraction& operator%=(const long int&)' must have
an argument of class or enumerated type
fraction.h:98: error: 'fraction& operator%=(const long int&)' must take
exactly two arguments