From: Lukas Jiriste Date: Thu, 10 Oct 2024 10:01:40 +0000 (+0200) Subject: Add default constructor for Zombie in ex00 X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=d814ec568597e823266d62a2b5a8d5a4fb3facb4;p=42%2FCPP_Module_01 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"). --- 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); }