请教一个比较基础的问题。。
下面的代码,能被正确编译的是1、2、3、4哪个?
程序代码:class Test{
public:
Test(){a=0;c=0;} //1
int f(int a)const{this->a=a;} //2
static int g(){return a;} //3
void h(int b){Test::b=b;} //4
private:
int a;
static int b;
const int c;
};
int Test::b=0;
我只感觉4错了额,静态数据成员只能被初始化一次。还有哪几行是错的?请教各位哈,这是二级C++模拟题中的一道
[ 本帖最后由 sunflower44 于 2011-9-4 17:34 编辑 ]



