ex00: remove useless func and rename announe to announce

This commit is contained in:
Camille Chauvet 2023-07-31 17:50:17 +02:00
parent cc5928a671
commit cebe9f6ea7
3 changed files with 3 additions and 17 deletions

View File

@ -13,23 +13,12 @@ Zombie::Zombie(const std::string& name)
this->_name = name; this->_name = name;
} }
Zombie::Zombie(const Zombie& src)
{
*this = src;
}
Zombie::~Zombie() Zombie::~Zombie()
{ {
std::cout << "~Zombie()" << std::endl; std::cout << "~Zombie()" << std::endl;
} }
Zombie& Zombie::operator=(const Zombie& src) void Zombie::announce()
{
this->_name = src._name;
return *this;
}
void Zombie::announe()
{ {
std::cout << this->_name << ": BraiiiiiiinnnzzzZ..." << std::endl; std::cout << this->_name << ": BraiiiiiiinnnzzzZ..." << std::endl;
} }

View File

@ -8,14 +8,11 @@ class Zombie
std::string _name; std::string _name;
public: public:
Zombie(const Zombie& src);
Zombie(); Zombie();
Zombie(const std::string& name); Zombie(const std::string& name);
~Zombie(); ~Zombie();
Zombie& operator=(const Zombie& src); void announce(void);
void announe(void);
void setName(const std::string& name); void setName(const std::string& name);
}; };

View File

@ -8,7 +8,7 @@ int main()
Zombie* bob = zombieHorde(4, "bob"); Zombie* bob = zombieHorde(4, "bob");
for (size_t i = 0; i < 4; i++) for (size_t i = 0; i < 4; i++)
bob[i].announe(); bob[i].announce();
delete[] bob; delete[] bob;
Zombie* pierre = zombieHorde(-1, "pierre"); Zombie* pierre = zombieHorde(-1, "pierre");
if (pierre == NULL) if (pierre == NULL)