CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Dog.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Dog.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/20 16:25:12 by kamitsui #+# #+# */
9/* Updated: 2025/06/03 22:47:51 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
21#ifndef DOG_HPP
22#define DOG_HPP
23
24#include "Animal.hpp" // Inherits from Animal
25#include "Brain.hpp"
26
34class Dog : public Animal {
35 private:
36 Brain *brain;
37
38 public:
39 Dog();
40 Dog(const Dog &other);
41 Dog &operator=(const Dog &other);
42 virtual ~Dog();
43
44 virtual void makeSound() const;
45 void bark() const;
46 Brain *getBrain() const;
47
48 private:
49 void swap(Dog &other);
50};
51
52#endif
The Animal class represents a generic animal.
Definition Animal.hpp:37
Represents the brain of an animal, holding a collection of ideas.
Definition Brain.hpp:37
The Dog class represents a canine animal.
Definition Dog.hpp:33
Dog & operator=(const Dog &other)
Dog(const Dog &other)
virtual ~Dog()
virtual void makeSound() const
Makes a generic animal sound. This implementation is for the base Animal class. Derived classes are e...
Brain * getBrain() const
Gets a pointer to the Dog's Brain object.
Definition Dog.cpp:94
void bark() const
Makes a specific barking sound for a Dog. This is a Dog-specific method.
Definition Dog.cpp:88
Declares the abstract Animal base class.
Declares the Brain class.