productitem.h.html

来自「《Big C++ 》Third Edition电子书和代码全集-Part1」· HTML 代码 · 共 42 行

HTML
42
字号
<html>

<head>
	<title>productitem.h</title>
</head>

<body>
<pre>  1  #ifndef PRODUCTITEM_H
  2  #define PRODUCTITEM_H
  3  
  4  #include "product.h"
  5  #include "item.h"
  6  
  7  <font color='#0000cc'>/**
  8     An item that results from selling a quantity of a product
  9  */</font>
 10  class ProductItem : public Item
 11  {
 12  public:
 13     <font color='#0000cc'>/**
 14        Constructs this item.
 15        @param p the product that is being sold
 16        @param q the quantity
 17     */</font>
 18     ProductItem(const Product&amp; p, int q);
 19     virtual double get_unit_price() const;
 20     virtual string get_description() const;
 21     virtual int get_quantity() const;
 22  private:
 23     Product prod;
 24     int quantity;
 25  };
 26  
 27  inline int ProductItem::get_quantity() const
 28  {
 29     return quantity;
 30  }
 31  
 32  #endif</pre>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?