31 for (
int i = 0; i < 100; ++i) {
32 this->ideas[i] =
"Thinking...";
44 for (
int i = 0; i < 100; ++i) {
45 this->ideas[i] = other.ideas[i];
60 for (
int i = 0; i < 100; ++i) {
61 this->ideas[i] = other.ideas[i];
81 if (index >= 0 && index < 100) {
82 this->ideas[index] = idea;
93 if (index >= 0 && index < 100) {
94 return this->ideas[index];
Represents the brain of an animal, holding a collection of ideas.
const std::string & getIdea(int index) const
Gets an idea from a specific index in the brain. Performs bounds checking. If the index is out of bou...
Brain & operator=(const Brain &other)
Copy assignment operator for Brain. Performs a deep copy of all ideas from another Brain object....
Brain()
Default constructor for Brain. Initializes all 100 ideas to "Thinking...". Displays a construction me...
void setIdea(int index, const std::string &idea)
Sets an idea at a specific index in the brain. Performs bounds checking to ensure the index is valid ...
~Brain()
Destructor for Brain. Displays a destruction message. No dynamic memory to free directly within Brain...
Declares the Brain class.