Website Summary Files Commits Branches @commit @diff @stats
path: root / Week10 / Exercise03 / Shop.h
blob: ce1c8deb8bd52cc4c20e23cd7d5dae0af86ed5a7 (plain) (blame)
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
32
33
34
35
#ifndef _SHOP
#define _SHOP

#include "Inventory.h"
#include "Date.h"

struct Sale {
	char productName[PRODUCT_NAME_LENGTH];
	unsigned quantity;
	Date date;
};

class Shop : public Inventory {
	Sale* sales;
	unsigned salesCount;
	unsigned salesAlloc;

	void free();
	void copyFrom(const Shop& other);

	void resize();

public:
	Shop();
	~Shop();
	Shop(const Shop& other);
	Shop& operator=(const Shop& other);

	Shop(Shop&& other);
	Shop& operator=(Shop&& other);

	bool Purchase(const Sale& sale);
};

#endif /* _SHOP */