feat: change the return of the overload '='

This commit is contained in:
Raphael 2025-02-10 12:11:38 +01:00
parent 2fc4472427
commit a84ff7d969
6 changed files with 38 additions and 10 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/10 13:59:49 by rparodi #+# #+# */
/* Updated: 2025/02/10 11:13:02 by rparodi ### ########.fr */
/* Updated: 2025/02/10 12:09:57 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,7 +45,7 @@ ClapTrap& ClapTrap::operator=(ClapTrap &assign) {
_energy_point = assign._energy_point;
_attack_damage = assign._attack_damage;
std::cout << "\n[Init] ClapTrap (assign):\n\t" << "Name: " << _name << std::endl;
return (assign);
return (*this);
}
ClapTrap::~ClapTrap() {

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/24 17:41:01 by rparodi #+# #+# */
/* Updated: 2025/02/10 11:13:33 by rparodi ### ########.fr */
/* Updated: 2025/02/10 12:10:09 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -42,7 +42,7 @@ FragTrap& FragTrap::operator=(FragTrap &assign) {
_energy_point = assign._energy_point;
_attack_damage = assign._attack_damage;
std::cout << "\n[Init] FragTrap (assign):\n\t" << "Name: " << _name << std::endl;
return (assign);
return (*this);
}
FragTrap::~FragTrap() {

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/24 17:41:01 by rparodi #+# #+# */
/* Updated: 2025/02/10 11:12:27 by rparodi ### ########.fr */
/* Updated: 2025/02/10 12:10:42 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -46,7 +46,7 @@ ScavTrap& ScavTrap::operator=(ScavTrap &assign) {
_attack_damage = assign._attack_damage;
_gateKeeperMode = assign._gateKeeperMode;
std::cout << "\n[Init] ScavTrap (assign):\n\t" << "Name: " << _name << std::endl;
return (assign);
return *this;
}
ScavTrap::~ScavTrap() {