阅读背景:

C ++运算符使用指向类的指针重载

来源:互联网 

This is my class:

这是我的班级:

class B : public A{
private:
double r;


public:
B(){};
B(double x_, double y_, double r_){
    x1 = x_; y1 = y_; r = r_;
};
~B(){};
B operator+(const B&  other)
{
    double result_r = r + other.r;
    return B(x1, y1, result_r);
}
B operator*(const B&  other)
{
    double result_r = this->r * other.r;
    return B(x1, y1, result_r);
}
int operator<(const B&  other){
    if (this->r<other.r)return 1; else return 0;
}
int operator>(const B&  other){
    if (this->r>other.r)return 1; else return 0;
}
};
class B : public 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: