August 2012
Intermediate to advanced
976 pages
30h 17m
English
Now we can reimplement Bulk_quote to inherit from Disc_quote rather than inheriting directly from Quote:
// the discount kicks in when a specified number of copies of the same book are sold// the discount is expressed as a fraction to use to reduce the normal priceclass Bulk_quote : public Disc_quote {public: Bulk_quote() = default; Bulk_quote(const std::string& book, double price, std::size_t qty, double disc): Disc_quote(book, price, qty, disc) { } // overrides the base version to implement the bulk purchase discount policy double net_price(std::size_t) const override;};
This version of Bulk_quote has a direct base class, Disc_quote, and an ...
Read now
Unlock full access