#include <iostream>
using namespace std;
class Point{
int x,y;
public:
***Point(int a,int b){}//:x(a),y(b){}// { x=a; y=b;}***
void MovePoint( int a, int b){ x+=a; y+=b;this->x+=a;cout<<"this="<<this<<endl;}
void print()
{
cout<<"x="<<x<<" "<<this->x<<"y="<<y<<" "<<this->y<<endl;
}
};
void main(){
Point point1( 10,10);
point1.MovePoint(2,2);
point1.print();
}
c++构造函数
最新推荐文章于 2024-03-21 21:00:20 发布