CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Brain.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Brain.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/20 23:16:54 by kamitsui #+# #+# */
9/* Updated: 2025/05/23 22:41:53 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
23#ifndef BRAIN_HPP
24#define BRAIN_HPP
25
26#include <iostream>
27#include <string>
28
37class Brain {
38 private:
39 std::string ideas[100];
40
41 public:
42 Brain();
43 Brain(const Brain &other);
44 Brain &operator=(const Brain &other);
45 ~Brain();
46
47 void setIdea(int index, const std::string &idea);
48 const std::string &getIdea(int index) const;
49};
50
51#endif
Represents the brain of an animal, holding a collection of ideas.
Definition Brain.hpp:37
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...
Definition Brain.cpp:92
Brain & operator=(const Brain &other)
Copy assignment operator for Brain. Performs a deep copy of all ideas from another Brain object....
Definition Brain.cpp:57
Brain()
Default constructor for Brain. Initializes all 100 ideas to "Thinking...". Displays a construction me...
Definition Brain.cpp:29
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 ...
Definition Brain.cpp:80
~Brain()
Destructor for Brain. Displays a destruction message. No dynamic memory to free directly within Brain...
Definition Brain.cpp:72