CPP01
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
newZombie.cpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* newZombie.cpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/04/14 21:07:48 by kamitsui #+# #+# */
9
/* Updated: 2025/04/23 01:34:33 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
18
#include "
Zombie.hpp
"
19
29
Zombie
*
newZombie
(
std::string
name) {
30
Zombie
*zombie = NULL;
31
32
try
{
33
zombie =
new
Zombie
(name);
34
}
catch
(
const
std::bad_alloc
&e) {
35
std::cerr
<<
"Error: Failed to allocate memory for Zombie '"
<< name <<
"'"
<<
std::endl
;
36
std::cerr
<<
"Reason: "
<< e.
what
() <<
std::endl
;
37
}
38
return
zombie;
39
}
std::endl
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
std::cerr
ostream cerr
std::bad_alloc
std::bad_alloc::what
virtual const char * what() const
std::basic_string
Zombie
Represents a Zombie.
Definition
Zombie.hpp:30
Zombie.hpp
Declares the Zombie class and the zombieHorde function.
newZombie
Zombie * newZombie(std::string name)
Creates a new Zombie on the heap.
Definition
newZombie.cpp:29
ex00
newZombie.cpp
構築:
1.9.8