From d814ec568597e823266d62a2b5a8d5a4fb3facb4 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 10 Oct 2024 12:01:40 +0200 Subject: [PATCH] Add default constructor for Zombie in ex00 This is done to comply with the orthodox canonical form as a practice (and because it is needed in ex01 for "new[] Zombie"). --- ex00/Zombie.h | 2 +- ex00/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ex00/Zombie.h b/ex00/Zombie.h index 99a0b6e..243bd47 100644 --- a/ex00/Zombie.h +++ b/ex00/Zombie.h @@ -9,7 +9,7 @@ class Zombie std::string m_name; public: - Zombie(std::string name); + Zombie(std::string name = "zombie"); Zombie &operator=(const Zombie &zombie); Zombie(const Zombie &zombie); ~Zombie(); diff --git a/ex00/main.cpp b/ex00/main.cpp index 51f2d40..a2340f1 100644 --- a/ex00/main.cpp +++ b/ex00/main.cpp @@ -6,6 +6,7 @@ void randomChump(std::string name); int main(void) { + Zombie generic; Zombie zombie("Edd"); Zombie *zombie_p; @@ -14,5 +15,6 @@ int main(void) zombie.announce(); randomChump("Eddy"); delete zombie_p; + generic.announce(); return (0); } -- 2.30.2