-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommodityManage.h
31 lines (27 loc) · 954 Bytes
/
CommodityManage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef COMMODITYMANAGE_H
#define COMMODITYMANAGE_H
#include"Commodity.h"
class CommodityManage{
public:
CommodityManage();
CommodityManage(int s);
// ~CommodityManage(){delete[] pCommodities;}
CommodityManage(const CommodityManage& c)=delete;
CommodityManage& operator=(const CommodityManage& c)=delete;
// void addCommodity(const Commodity& c);
void addCommodity( Commodity* p);
void removeCommodity(int id);
void viewCommodity(int id)const;
void viewAllCommodities()const;
void checkOut()const;
void readData(std::string filename);
void saveData(std::string filename);
private:
//Commodity *pCommodities; //指向动态创建的商品数组
Commodity **pCommodities; //指向动态创建的商品指针数组
int maxSize; //当前分配的空间上限
int size; //实际的商品数量
Commodity* findCommodityById(int id)const;
void reAllocMemory();
};
#endif // COMMODITYMANAGE_H