#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
class Point{
private:
int X,Y,Z;
static int count;
public:
Point (int xx=0,int yy=0,int zz=0):X(xx),Y(yy),Z(zz){
count++;
}
void Display(){
cout <<"The point is XX YY ZZ"<<X<<","<<Y<<","<<Z<<endl;
}
};
int Point::count=0;
int main(int argc, char** argv) {
Point p1(1,2,3),p2(4,5,6);
p1.Display();
p2.Display();
return 0;
}
C++在类中定义静态数据成员
最新推荐文章于 2022-10-29 22:25:37 发布