请教,为何类中const变量和引用必须要使用成员初始化列表来初始化?
class example{
private:
const int num;
int& ret;
public:
example(int n,int f):num(n),ret(f)//请问num和ret为何一定要用成员初始化列表来初始化?最好能举例说明,谢谢!
}
2012-06-14 15:56
2012-06-14 18:10
2012-06-14 18:12
2012-06-15 15:03
2012-07-23 15:48