Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 14 / Farm / Collection / Farm.h
blob: 77429739a37ae1f18119059f6352e00e2ac6e54f (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
#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;
};