diff options
| author | Syndamia <kamen@syndamia.com> | 2024-04-04 20:11:12 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2024-04-04 20:11:12 +0300 |
| commit | a2e284b0056075e2365deaa2455be567c3b3c945 (patch) | |
| tree | 8a842d1f2ffb9f00989b39d2ab7a7ade1a858d81 /week07/Exercise1.h | |
| parent | 44d085f265583f0e3cbef294bbe2c8e300aaa452 (diff) | |
| download | oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.tar oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.tar.gz oop-2023-solutions-a2e284b0056075e2365deaa2455be567c3b3c945.zip | |
[w7] Added exercise descriptions and solutions
Diffstat (limited to 'week07/Exercise1.h')
| -rw-r--r-- | week07/Exercise1.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/week07/Exercise1.h b/week07/Exercise1.h new file mode 100644 index 0000000..6de1a09 --- /dev/null +++ b/week07/Exercise1.h @@ -0,0 +1,25 @@ +struct Ingredient { + char name[512]; + float amount; +}; + +class Recipe { + Ingredient* ingredients; + unsigned lastIndex; + unsigned allocated; + + void resize(); + void free(); + void copyFrom(const Recipe& other); + +public: + Recipe(); + ~Recipe(); + Recipe(const Recipe& other); + Recipe& operator=(const Recipe& other); + Recipe(Recipe&& other); + Recipe& operator=(Recipe&& other); + + void AddIngredient(const Ingredient& newIng); + void RemoveIngredient(const char* name); +}; |
