|
| Brain () |
| Default constructor for Brain. Initializes all 100 ideas to "Thinking...". Displays a construction message.
|
|
| Brain (const Brain &other) |
| Copy constructor for Brain. Performs a deep copy of all ideas from another Brain object. Displays a copy construction message.
|
|
Brain & | operator= (const Brain &other) |
| Copy assignment operator for Brain. Performs a deep copy of all ideas from another Brain object. Handles self-assignment to prevent issues. Displays a copy assignment message.
|
|
| ~Brain () |
| Destructor for Brain. Displays a destruction message. No dynamic memory to free directly within Brain itself, as ideas is a fixed-size array of std::string.
|
|
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 (0-99).
|
|
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 bounds, an empty string is returned.
|
|
| Brain () |
|
| Brain (const Brain &other) |
|
Brain & | operator= (const Brain &other) |
|
| ~Brain () |
|
void | setIdea (int index, const std::string &idea) |
|
const std::string & | getIdea (int index) const |
|
Represents the brain of an animal, holding a collection of ideas.
The Brain class manages an array of 100 std::string objects, conceptually representing the animal's thoughts. It is designed to support deep copying, ensuring that when a Brain object is copied, its entire set of ideas is duplicated, not just referenced.
Brain.hpp の 37 行目に定義があります。