我一直在努力学习C++.最近我遇到了以下代码:
#include <iostream>
using namespace std;
class Point {
private:
double x_, y_;
public:
Point(double x, double y){
x_ = x;
y_ = y;
}
Point() {
x_ = 0.0;
y_ = 0.0;
}
double getX(){
return x_;
}
double getY(){
return y_;
}
void setX(double x){
x_ = x;
}
void setY(double y){
y_ = y;
}
void add(Point p){
x_ += p.x_;
y_ += p.y_;
}
void sub(Point p){
x_ -= p.x_;
y_ -= p.y_;
}
void mul(double …
Run Code Online (Sandbox Code Playgroud)