Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 14 / Farm / Collection / Farm.h
diff options
context:
space:
mode:
1 files changed, 32 insertions, 0 deletions
-rw-r--r--Sem. 14/Farm/Collection/Farm.h32
diff --git a/Sem. 14/Farm/Collection/Farm.h b/Sem. 14/Farm/Collection/Farm.h
new file mode 100644
index 0000000..7742973
--- /dev/null
+++ b/Sem. 14/Farm/Collection/Farm.h
@@ -0,0 +1,32 @@
+#pragma once
+#include "../Animals/Animal.h"
+#include "../Factory/Factory.h"
+
+class Farm
+{
+ Animal** animals;
+ size_t animalsCount;
+ size_t capacity;
+
+ void free();
+ void copyFrom(const Farm& other);
+ void resize();
+
+ AnimalFactory factory; //better singelton
+
+public:
+ Farm();
+ Farm(const Farm& other);
+ Farm& operator=(const Farm& other);
+ ~Farm();
+
+ void addAnimal(const Animal& animal);
+ bool addAnimal(Animal::AnimalType animalType);
+
+ void allSayHello() const;
+
+ size_t getCount() const;
+ bool isEmpty() const;
+
+ Animal::AnimalType getTypeByIndex(size_t index) const;
+};