这是我的代码的一部分:C++构造错误
virtual bool operator==(const File& file) const = 0;
和.cpp文件
bool File::operator==(const File& file) const {
return true;
}
我得到这个编译错误:在.h文件 宣言
1>c:\users\talw\desktop\hw5\hw5\project1\main.cpp(76): error C2259:
'Directory' : cannot instantiate abstract class
1> due to following members:
1> 'bool File::operator ==(const File &) const' : is abstract
1> c:\users\talw\desktop\hw5\hw5\project1\file.h(57) : see
declaration of 'File::operator =='
请帮忙。 谢谢
我没有看到构造函数...? –
该类是抽象的,所以删除= 0位 –
所以...为什么你把'= 0'在运算符声明? – AnT