Add default constructor for Zombie in ex00
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 10 Oct 2024 10:01:40 +0000 (12:01 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 10 Oct 2024 10:01:40 +0000 (12:01 +0200)
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
ex00/main.cpp

index 99a0b6e51feafba0701efb31e7a7f71fbaa900c7..243bd474edfda30cd0590f5ec9d5fb1c3b90c1bd 100644 (file)
@@ -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();
index 51f2d408bebb52941d486250b7d3a1cdc3c0f2ec..a2340f16d88badb375f3d5691b0b6e22c3545cb9 100644 (file)
@@ -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);
 }