此类标记以下错误:'非静态 const 成员'const int Member::membershipNo',不能使用默认赋值运算符'。奇怪的是这段代码在另一个项目中重复并且完美运行。你能帮我把它改正吗?
会员.h
class Member : public Person
{
public:
Member();
Member(int membershipNo);
virtual ~Member();
int getMembershipNo() const;
private:
const int membershipNo;
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<Person>(*this);
ar & membershipNo;
}
};
会员.cpp
Member::Member() : membershipNo(0)
{
Person();
}
Member::Member(int memberNo) : membershipNo(memberNo)
{
Person();
}
Member::~Member()
{
// TODO Auto-generated destructor stub
}
int Member::getMembershipNo() const
{
return membershipNo;
}