I guess this is a n00b question because I couldn't find anything about it on web...
Here is Point class:
class Point {
public:
Point();
Point(double x, double y);
double getX() const;
double getY() const;
void setX(double);
void setY(double);
friend std::ostream& operator<<(std::ostream& os, const Point& obj);
private:
double x;
double y;
};
And here is an implementation of operator<< function:
inline std::ostream& operator<<(std::ostream& os, const Point& obj) {
os << "(" << obj.getX() << "," << obj.getY() << ")";
return os;
}
Now, in main function I have Point *p;
... How can I print it using std::cout
?