class Test{
public:
Test(){ a=0; c=0; } // ①
int f(int a)const { this->a=a; } // ②
static int g(){ return a; } // ③
void h(int b) { Test::b=b; } // ④
private:
int a;
static int b;
const int c;
};
int Test::b=0;
在注释部分标注号码的行中,能被正确编译的是( )。
1、 “Test::c”: 必须初始化常量限定类型的对象,c是常量,不能改变,所以赋值非法
2、对非静态成员“Test::a”的非法引用,通过const对象来访问a是不能进行数据修改的
3、非静态成员引用必须与特定对象相对 ,函数输出是static,但是a不是static