[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with operator%
From: |
Mike Wahler |
Subject: |
Re: help with operator% |
Date: |
Thu, 20 Oct 2005 02:54:26 GMT |
"Al-Burak" <jalqadir@netscape.net> wrote in message
1129773505.133834.286680@g43g2000cwa.googlegroups.com">news:1129773505.133834.286680@g43g2000cwa.googlegroups.com...
> In the program
> --- money.hpp
> namespace jme{
> class Money{
> protected: float amount;
> ...
> public: friend jme::Money jme::operator%( jme::Money&,
> jme::Money&);
> };
> }
> --- money.cpp
> jme::Money jme::operator%(jme::Money& lhs, jme::Money& rhs){
> jme::Money tmp;
> return tmp = lhs.amount % rhs.amount;
> }
>
> I get an error message, that reads:
> Project : Money
> Compiler : GNU GCC Compiler (called directly)
> Directory : c:\money\
> --------------------------------------------------------------------------------
> Switching to target: default
> Compiling: money.cpp
> money.cpp: In function `jme::Money jme::operator%(jme::Money&,
> jme::Money&)':
> money.cpp:72: error: invalid operands of types `float' and `float' to
> binary `operator
> --------------------------------------------------------------------------------
> What am I doing wrong?
Your compiler just told you: you're trying to use
an operator with a type for which it's not valid.
-Mike
- help with operator%, Al-Burak, 2005/10/19
- Re: help with operator%, GB, 2005/10/19
- Re: help with operator%, Greg Comeau, 2005/10/20
- Re: help with operator%, Mike Wahler, 2005/10/20
- Re: help with operator%, Greg, 2005/10/20
- Re: help with operator%, Simon Buchan, 2005/10/27
- Message not available
- Re: help with operator%, Greg Comeau, 2005/10/27
- Re: help with operator%, Greg Comeau, 2005/10/27
- Re: help with operator%, Greg Comeau, 2005/10/27
Re: help with operator%,
Mike Wahler <=
Re: help with operator%, address@hidden, 2005/10/20