我想问,不实现虚函数有问题吗?例如:
class Function {
public:
virtual ~Function() {}
virtual double value(double x) const = 0;
virtual Function* clone() const = 0;
protected:
virtual void print(ostream& os) const = 0;
friend ostream& operator<<(ostream& os, const Function& f);
};
在Function的派生类中,如果没有实现例如clone,会不会出现编译错误?或者如果我尝试调用derived.clone() 会是运行时错误吗?