【求助】c++运算符重载
Point.h:namespace main_savitch_2A
{
class point
{
public:
point(double x_amount,double y_amount)
{
x = x_amount;
y= y_amount;
}
double get_x() const {reurn x;}
double get_y() const { return y;}
ostream& orerator << (ostream& outs,const point source);
private:
double x;
double y;
}
..................
Point.cpp:
#include"Point.h"
namespace main_savitch_2A
{
ostream& point ::operator << (ostream &out, const main_savitch_2A::point &source)
{
outs << source.get_x() << "" << source.get_y() << endl;
return outs;
}
}
编译的时候,总是说重载操作符那里的变量太多,那位达人知道是怎么回事啊,能否给个版本,简单写下就好