CPP04
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Animal.hpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* Animal.hpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/05/20 16:24:30 by kamitsui #+# #+# */
9
/* Updated: 2025/05/28 23:40:47 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
23
#ifndef ANIMAL_HPP
24
#define ANIMAL_HPP
25
26
#include <
iostream
>
27
#include <
string
>
28
38
class
Animal
{
39
protected
:
40
std::string
type
;
41
42
public
:
43
Animal
();
44
Animal
(
const
Animal
&other);
45
Animal
&
operator=
(
const
Animal
&other);
46
virtual
~Animal
();
47
55
virtual
void
makeSound
()
const
= 0;
// Pure virtual function
56
const
std::string
&
getType
()
const
;
57
};
58
59
#endif
std::string
Animal
The Animal class represents a generic animal.
Definition
Animal.hpp:37
Animal::~Animal
virtual ~Animal()
Animal::Animal
Animal()
Animal::getType
const std::string & getType() const
Animal::makeSound
virtual void makeSound() const =0
Makes the sound appropriate for the animal.
Animal::operator=
Animal & operator=(const Animal &other)
Animal::Animal
Animal(const Animal &other)
Animal::type
std::string type
Definition
Animal.hpp:39
iostream
string
ex02
Animal.hpp
構築:
1.9.8