Tutorial :Error with C++ operator overloading, in Visual Studio AND Xcode


I am working on a C++ assignment for class that wants me to overload the ">>" operator. I am encountering errors linking in both Visual Studio 2005 and Xcode 3.2.2. The C++ code is separated into a few files. The prototypes are stored in overload.h, the implementations are stored in overload.cpp, and main() is in overloadtester.cpp (although I have not been able to put anything related to this new overloaded operator in main yet because of the error. below is the code I added before I started getting the errors (listed below)

// overload.h    // Class Name OverloadClass  #ifndef _OverloadClass_H  #define _OverloadClass_H  #include < string >    using namespace std ;  class OverloadClass  {  public:      // Constructors and methods  private:      x_;      y_;  };  istream& operator>> (istream& in, OverloadClass &p);  

Next Post »