diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-10 14:50:38 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-10 15:06:45 +0100 |
| commit | aa40eb5dedd39263ff511de01d6833d24e33b736 (patch) | |
| tree | 58031a52433ed08bb3347dd95ecb492b6b8c17ca /cpp03/ex04/SuperTrap.cpp | |
| parent | 18ca1fc67ccc7bf176287f7b2908a33a597ec67a (diff) | |
| download | piscine_cpp-aa40eb5dedd39263ff511de01d6833d24e33b736.tar.gz piscine_cpp-aa40eb5dedd39263ff511de01d6833d24e33b736.tar.bz2 piscine_cpp-aa40eb5dedd39263ff511de01d6833d24e33b736.zip | |
Changing operator= and const reference in Traps
Diffstat (limited to 'cpp03/ex04/SuperTrap.cpp')
| -rw-r--r-- | cpp03/ex04/SuperTrap.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cpp03/ex04/SuperTrap.cpp b/cpp03/ex04/SuperTrap.cpp index c30f973..7e96570 100644 --- a/cpp03/ex04/SuperTrap.cpp +++ b/cpp03/ex04/SuperTrap.cpp @@ -6,13 +6,13 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 17:52:56 by charles #+# #+# */ -/* Updated: 2020/04/13 17:55:14 by charles ### ########.fr */ +/* Updated: 2020/11/10 14:44:33 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "SuperTrap.hpp" -SuperTrap::SuperTrap(): +SuperTrap::SuperTrap() : m_prefix("SUP3R-TP"), m_hitPoints(100), m_maxHitPoints(100), @@ -27,7 +27,7 @@ SuperTrap::SuperTrap(): std::cout << m_prefix << "New " << m_name << ": your gaming references suck" << std::endl; } -SuperTrap::SuperTrap(std::string name): +SuperTrap::SuperTrap(std::string const& name) : m_prefix("SUP3R-TP"), m_hitPoints(100), m_maxHitPoints(100), @@ -57,6 +57,7 @@ void SuperTrap::operator=(SuperTrap const& other) m_meleeAttackDamage = other.m_meleeAttackDamage; m_rangedAttackDamage = other.m_rangedAttackDamage; m_armorDamageReduction = other.m_armorDamageReduction; + return *this; } SuperTrap::~SuperTrap() |
