class item_base
{
public:
item_base(const std::string & book = "" ,double sale_price= 0.0):isbn(book),price(sale_price){}
virtual ~item_base(){}
std::string book()const {return isbn;}
virtual double net_price(std::size_t n){return n*price ;}
private:
double price;
protected:
std::string isbn;
};
错误 一是类忘写; 二是string 的 s大写了, dev c++ 看错误太慢了。