diff --git a/ex01/src/main.cpp b/ex01/src/main.cpp index e9563ee..8351150 100644 --- a/ex01/src/main.cpp +++ b/ex01/src/main.cpp @@ -1,15 +1,17 @@ #include "Zombie.hpp" +#include int main() { Zombie* jean = zombieHorde(2, "jean"); delete[] jean; - Zombie* bob = zombieHorde(-1, "bob"); - if (bob == NULL) - return 1; - bob->announe(); + Zombie* bob = zombieHorde(4, "bob"); + for (size_t i = 0; i < 4; i++) + bob[i].announe(); delete[] bob; - + Zombie* pierre = zombieHorde(-1, "pierre"); + if (pierre == NULL) + return 1; return 0; } diff --git a/ex01/src/zombieHorde.cpp b/ex01/src/zombieHorde.cpp index e795d29..bb76f9d 100644 --- a/ex01/src/zombieHorde.cpp +++ b/ex01/src/zombieHorde.cpp @@ -7,9 +7,6 @@ Zombie* zombieHorde(int N, std::string name) return NULL; Zombie* zombies = new Zombie[N]; for (int i = 0; i < N; i++) - { zombies[i].setName(name); - zombies[i].announe(); - } return zombies; }