diff options
feat(Week10): Add solutions
1 files changed, 36 insertions, 0 deletions
| -rw-r--r-- | Week10/Exercise03/Inventory.h | 36 |
diff --git a/Week10/Exercise03/Inventory.h b/Week10/Exercise03/Inventory.h new file mode 100644 index 0000000..7f5eeca --- /dev/null +++ b/Week10/Exercise03/Inventory.h @@ -0,0 +1,36 @@ +#ifndef _INVENTORY +#define _INVENTORY + +const unsigned PRODUCT_NAME_LENGTH = 1024; + +struct Product { + char name[PRODUCT_NAME_LENGTH]; + unsigned quantity; +}; + +class Inventory { +protected: + Product* products; + unsigned productsCount; + unsigned productsAlloc; + +private: + void free(); + void copyFrom(const Inventory& other); + + void resize(); + +public: + Inventory(); + ~Inventory(); + Inventory(const Inventory& other); + Inventory& operator=(const Inventory& other); + + Inventory(Inventory&& other); + Inventory& operator=(Inventory&& other); + +protected: + void AddProduct(const Product& product); +}; + +#endif /* _INVENTORY */ |
