class a
{
protected:
const int _ID;
public:
a::a(int id){};
a::top(int num);
};
class b : public a
{
static int ok;
b::b(int id):a(id){};
a::top(ok);
}
int main()
{
int t=5;
b opj=b(t);
}
Run Code Online (Sandbox Code Playgroud)
首先,为什么我得到这个编译错误,只有当我删除const时解决
非静态const成员'const int Student :: _ ID',不能使用默认赋值运算符 - 实例化自'void std :: vector :: _ M_insert_aux(__ gnu_cxx :: __ normal_iterator,const _Tp&)[with _Tp = Student,_Alloc =的std ::分配器]"
第二
我有另一个问题
未定义的引用b :: ok