-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrain.cpp
More file actions
50 lines (43 loc) · 1.45 KB
/
Brain.cpp
File metadata and controls
50 lines (43 loc) · 1.45 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Brain.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/15 23:19:27 by zelhajou #+# #+# */
/* Updated: 2024/06/15 23:20:54 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Brain.hpp"
Brain::Brain()
{
std::cout << "Brain created.\n";
}
Brain::Brain(const Brain& other)
{
std::cout << "Brain copied.\n";
for (int i = 0; i < 100; i++)
ideas[i] = other.ideas[i];
}
Brain& Brain::operator=(const Brain& other)
{
if (this != &other) {
for (int i = 0; i < 100; i++)
ideas[i] = other.ideas[i];
}
std::cout << "Brain assigned.\n";
return *this;
}
Brain::~Brain()
{
std::cout << "Brain destroyed.\n";
}
void Brain::setIdea(int index, std::string idea)
{
ideas[index] = idea;
}
std::string Brain::getIdea(int index) const
{
return ideas[index];
}