From 4c30e98f4a4018a25d3a9f3ee790d589be803cb0 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Fri, 13 Nov 2020 14:43:17 +0100 Subject: Added main for cpp04/ex01 and cpp04/ex02, Fixed cpp04/03 MateriaSource --- cpp04/ex03/AMateria.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cpp04/ex03/AMateria.cpp') diff --git a/cpp04/ex03/AMateria.cpp b/cpp04/ex03/AMateria.cpp index 1dc7ca9..b08c4f2 100644 --- a/cpp04/ex03/AMateria.cpp +++ b/cpp04/ex03/AMateria.cpp @@ -6,21 +6,21 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/14 16:26:57 by charles #+# #+# */ -/* Updated: 2020/11/12 15:40:23 by cacharle ### ########.fr */ +/* Updated: 2020/11/13 14:26:28 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "AMateria.hpp" -AMateria::AMateria(AMateria const& other) +AMateria::AMateria(AMateria const& other) : m_type(other.m_type) { *this = other; - m_type = ""; } AMateria& AMateria::operator=(AMateria const& other) { - _xp = other._xp; + _xp = other._xp; + // subject doesn't want type to be copied return *this; } @@ -28,13 +28,13 @@ AMateria::~AMateria() {} AMateria::AMateria(std::string const& type) : m_type(type), _xp(0) {} -std::string const& AMateria::getType() const +std::string const& AMateria::getType() const { return m_type; } +unsigned int AMateria::getXP() const { return _xp; } + +void AMateria::use(ICharacter& target) { - return m_type; + (void)target; + _xp += 10; } -unsigned int AMateria::getXP() const { return _xp; } - -void AMateria::use(ICharacter& target) { _xp += 10; } - AMateria::AMateria() {} -- cgit