diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-13 14:43:17 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-13 14:43:17 +0100 |
| commit | 4c30e98f4a4018a25d3a9f3ee790d589be803cb0 (patch) | |
| tree | 655a4bd52a7a6633a32782eab935fb01a47040e9 /cpp04/ex03/AMateria.cpp | |
| parent | b8e39b947890e74d82530e25ad9d02668aae1f0c (diff) | |
| download | piscine_cpp-4c30e98f4a4018a25d3a9f3ee790d589be803cb0.tar.gz piscine_cpp-4c30e98f4a4018a25d3a9f3ee790d589be803cb0.tar.bz2 piscine_cpp-4c30e98f4a4018a25d3a9f3ee790d589be803cb0.zip | |
Added main for cpp04/ex01 and cpp04/ex02, Fixed cpp04/03 MateriaSource
Diffstat (limited to 'cpp04/ex03/AMateria.cpp')
| -rw-r--r-- | cpp04/ex03/AMateria.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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() {} |
