I have a class that overloads the inserter and the extractor operators,
but there is a problem with the way I worte the methods; because the
compiler does not like it at all.
This is the snip of what the problem looks like:
--- money.hpp
friend std::ostream& std::operator<<( std::ostream&, const jme::Money&
); friend std::istream& std::operator>>( std::istream&,
jme::Money& );
--- money.cpp
std::ostream&
std::operator<<( std::ostream& os, const jme::Money& obj ) {
os << obj.getAmount();
return os;
}
std::istream&
std::operator>>( std::istream& is, jme::Money& obj ) {
is >> obj.amount;
return is;
}
--- error
In file included from money.cpp:2:
money.hpp:67: error: `std::ostream& std::operator<<(std::ostream&,
const jme::Money&)' should have been declared inside `std'
money.hpp:68: error: `std::istream& std::operator>>(std::istream&,
jme::Money&)' should have been declared inside `std'
What am I doing wrong?
Can anybody help?
TIA
_______________________________________________
Help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus