I am trying to make a point class for school, and I get this error: "Error E2080 Point.h 20: 'Point::operator <<(ostream &,const Point &)' must be declared with one parameter". I have no idea what to do, as I had code that worked before like this with the apmatrix class. This is my code (all the relevant parts):
Code://Point.h #include <iostream> using namespace std; class Point { public: ostream& operator <<(ostream&, const Point&); private: int m_x; int m_y; }; //Point.cpp ostream& Point::operator <<(ostream& os, const Point& p) { os << "(" << p.m_x << "," << p.m_y << ")"; return *this; //? }




Reply With Quote