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
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}
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
ostream cerr
virtual const char * what() const
Represents a Zombie.
Definition Zombie.hpp:30
Declares the Zombie class and the zombieHorde function.
Zombie * newZombie(std::string name)
Creates a new Zombie on the heap.
Definition newZombie.cpp:29