#include
using namespace std;
class Point
{
double x,y;
static int m;
public:
Point(double a=0,double b=0):x(a),y(b)
{
m++;
}
~Point()
{
m--;
}
void show()
{
cout<<"the number of Point is "<<m<<endl;
}
};
int Point::m=0;
int main()
{
Point p1;
Point *p=new Point(1,2);
p->show();
delete p;
p1.show();
return 0;
}
想问一下,题里面的x,y,a,b有什么用啊?

静态数据成员程序填空题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- cnkeysky 2022-06-10 18:57关注
c++的成员初始化列表, 为x,y赋值,相当于 x=a;y=b;
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报