item.h
来自「big c++英文版书籍」· C头文件 代码 · 共 43 行
H
43 行
#include "product.h"
/**
Describes a product to purchase and its quantity.
*/
class Item
{
public:
/*
Constructs an item from the product and quantity
@param p the product
@param q the item quantity
*/
Item(Product p, int q);
/**
Gets the product of this item.
@return the product
*/
Product get_product() const;
/**
Gets the quantity of this item.
@return the quantity
*/
int get_quantity() const;
/*
Computes the total cost of this item.
@return the total price
*/
double get_total_price() const;
/*
prints this item.
*/
void print() const;
private:
int quantity;
Product prod;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?