feat: change the return of the overload '='
This commit is contained in:
parent
2fc4472427
commit
a84ff7d969
6 changed files with 38 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/10 13:59:49 by rparodi #+# #+# */
|
||||
/* Updated: 2025/02/10 10:53:38 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/02/10 12:09:57 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ ClapTrap::ClapTrap() {
|
|||
_energy_point = 0;
|
||||
_attack_damage = 0;
|
||||
|
||||
std::cout << "\n[Init] ClapTrap (no_name):\n\t" << "Name: " << _name << std::endl;
|
||||
std::cout << "\n[Init] ClapTrap (no_name)" << std::endl;
|
||||
}
|
||||
|
||||
ClapTrap::ClapTrap(std::string name) {
|
||||
|
|
@ -39,6 +39,15 @@ ClapTrap::ClapTrap(ClapTrap const ©) {
|
|||
std::cout << "\n[Init] ClapTrap (copy):\n\t" << "Name: " << _name << std::endl;
|
||||
}
|
||||
|
||||
ClapTrap& ClapTrap::operator=(ClapTrap &assign) {
|
||||
_name = assign._name;
|
||||
_hit_point = assign._hit_point;
|
||||
_energy_point = assign._energy_point;
|
||||
_attack_damage = assign._attack_damage;
|
||||
std::cout << "\n[Init] ClapTrap (assign):\n\t" << "Name: " << _name << std::endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ClapTrap::~ClapTrap() {
|
||||
std::cout << "\n[Delete] ClapTrap:\n\t" << "Name: " << _name << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue