64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class A{
private:
static int i;
public:
void set(int x)const;
void get(){
cout<<i<<endl;
}
};
void A::set(int x)const{
i = x;
}
int A::i = 10;
int main(){
A a;
a.set(100);
a.get(); //output:100
return 0;
}