更新时间2018-03-18 09:22:50
可以直接修改啊.但有两种访问方法
#include <iostream>
using namespace std;
class Test
{
public:
static string x;
};
string Test::x=""; //初始化
int main(void)
{
Test s;
s.x="hello"; //方法一
cout <<s.x << endl;
Test::x="hello1"; //方法二
cout <<s.x << endl;
return 0;
}
上一篇:c-free输出所有的水仙花数
下一篇:STC89C52单片机怎么不了