15.2.2. Defining a Derived Class
A derived class must specify from which class(es) it inherits. It does so in its class derivation list, which is a colon followed by a comma-separated list of names of previously defined classes. Each base class name may be preceded by an optional access specifier, which is one of public
, protected
, or private
.
A derived class must declare each inherited member function it intends to override. Therefore, our Bulk_quote
class must include a net_price
member:
class Bulk_quote : public Quote { // Bulk_quote inherits from Quote Bulk_quote() = default; Bulk_quote(const std::string&, double, std::size_t, double); ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.