J
jalkadir
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:stream& std:perator<<( std:stream&, const jme::Money&
); friend std::istream& std:perator>>( std::istream&,
jme::Money& );
--- money.cpp
std:stream&
std:perator<<( std:stream& os, const jme::Money& obj ) {
os << obj.getAmount();
return os;
}
std::istream&
std:perator>>( std::istream& is, jme::Money& obj ) {
is >> obj.amount;
return is;
}
--- error
In file included from money.cpp:2:
money.hpp:67: error: `std:stream& std:perator<<(std:stream&,
const jme::Money&)' should have been declared inside `std'
money.hpp:68: error: `std::istream& std:perator>>(std::istream&,
jme::Money&)' should have been declared inside `std'
What am I doing wrong?
Can anybody help?
TIA
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:stream& std:perator<<( std:stream&, const jme::Money&
); friend std::istream& std:perator>>( std::istream&,
jme::Money& );
--- money.cpp
std:stream&
std:perator<<( std:stream& os, const jme::Money& obj ) {
os << obj.getAmount();
return os;
}
std::istream&
std:perator>>( std::istream& is, jme::Money& obj ) {
is >> obj.amount;
return is;
}
--- error
In file included from money.cpp:2:
money.hpp:67: error: `std:stream& std:perator<<(std:stream&,
const jme::Money&)' should have been declared inside `std'
money.hpp:68: error: `std::istream& std:perator>>(std::istream&,
jme::Money&)' should have been declared inside `std'
What am I doing wrong?
Can anybody help?
TIA