[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: overloaded ops << and >>
From: |
jalkadir |
Subject: |
Re: overloaded ops << and >> |
Date: |
30 Jun 2005 22:11:52 -0700 |
User-agent: |
G2/0.2 |
Thank you Thomas for your help.
Here is the latest incarnation of my inserters and extractors:
friend std::ostream& operator<<( std::ostream&, const jme::Money& );
friend std::istream& operator>>( std::istream&, jme::Money
& );
std::ostream&
operator<<( std::ostream& os, const jme::Money& obj ) {
std::cout << "Check this out" << std::endl;
return os << obj.getAmount();
//return os;
}
std::istream&
operator>>( std::istream& is, jme
::Money& obj
) {
float tmp;
is >> tmp;
obj.setAmount(tmp);
return is;
}
I would expect that the statement
jme::Money money("12.21");
std::cout << " Value is: " << money << std::endl;
would display
Check this out
12.21
But in instead it displays 0x4c1094 !?
I don't even think my overloaded operators are beeing called when
extracting or inserting data.
I am really going *loco* with this part of the program. It just does
not make sence.
Can you help?
- Re: overloaded ops << and >>,
jalkadir <=