From b8e39b947890e74d82530e25ad9d02668aae1f0c Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 12 Nov 2020 15:46:07 +0100 Subject: Reformating cpp04 classes --- cpp04/ex01/AWeapon.cpp | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) (limited to 'cpp04/ex01/AWeapon.cpp') diff --git a/cpp04/ex01/AWeapon.cpp b/cpp04/ex01/AWeapon.cpp index 9c53839..5d43cd5 100644 --- a/cpp04/ex01/AWeapon.cpp +++ b/cpp04/ex01/AWeapon.cpp @@ -6,48 +6,30 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/14 12:16:04 by charles #+# #+# */ -/* Updated: 2020/04/14 13:18:07 by charles ### ########.fr */ +/* Updated: 2020/11/12 13:32:58 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "AWeapon.hpp" -AWeapon::AWeapon(AWeapon const& other) -{ - *this = other; -} - -void AWeapon::operator=(AWeapon const& other) -{ - m_name = other.m_name; - m_apcost = other.m_apcost; - m_damage = other.m_damage; -} - -AWeapon::~AWeapon() -{ -} - AWeapon::AWeapon(std::string const& name, int apcost, int damage) : m_name(name), m_apcost(apcost), m_damage(damage) -{ -} +{} -std::string const& AWeapon::getName() const -{ - return m_name; -} +AWeapon::AWeapon(AWeapon const& other) { *this = other; } -int AWeapon::getAPCost() const +AWeapon& AWeapon::operator=(AWeapon const& other) { - return m_apcost; + m_name = other.m_name; + m_apcost = other.m_apcost; + m_damage = other.m_damage; + return *this; } -int AWeapon::getDamage() const -{ - return m_damage; -} +AWeapon::~AWeapon() {} -AWeapon::AWeapon() -{ -} +std::string const& AWeapon::getName() const { return m_name; } +int AWeapon::getAPCost() const { return m_apcost; } +int AWeapon::getDamage() const { return m_damage; } + +AWeapon::AWeapon() {} -- cgit