I my program I have overloaded the inserters and extractor operator.
---name.hpp
    friend std::ostream& std::operator<<( std::ostream& os,
                                     const jme::Name& obj );
    friend std::istream& std::operator>>( std::istream& is,
                                     jme::Name& obj );
---name.cpp
std::ostream& std::operator<<( std::ostream& os, const jme::Name& obj )
{
    return os << obj.str;
}
std::istream& std::operator>>( std::istream& is, jme::Name& obj ) {
   return is >> obj.str;
}
------------------------
But this gives me an error that reads
Project   : Name
Compiler  : GNU GCC Compiler (called directly)
Directory : ..\dev\c++\jme\name\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
In file included from main.cpp:3:
name.hpp:83: error: `std::ostream& std::operator<<(std::ostream&, const
jme::Name&)' should have been declared inside `std'
name.hpp:85: error: `std::istream& std::operator>>(std::istream&,
jme::Name&)' should have been declared inside `std'
Process terminated with status 1 (0 minutes, 5 seconds)
 
---------------------


What am I doing wrong?

TIA

_______________________________________________
Help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to