diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-12 15:46:07 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-12 15:46:07 +0100 |
| commit | b8e39b947890e74d82530e25ad9d02668aae1f0c (patch) | |
| tree | f59acfdecb0711137c200a4c5acb854e351f9cf9 /cpp04/ex02/Squad.cpp | |
| parent | 96dcf214a8c40529b251ea31ef037868583dd1da (diff) | |
| download | piscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.tar.gz piscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.tar.bz2 piscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.zip | |
Reformating cpp04 classes
Diffstat (limited to 'cpp04/ex02/Squad.cpp')
| -rw-r--r-- | cpp04/ex02/Squad.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/cpp04/ex02/Squad.cpp b/cpp04/ex02/Squad.cpp index 11c7862..d1d988f 100644 --- a/cpp04/ex02/Squad.cpp +++ b/cpp04/ex02/Squad.cpp @@ -6,39 +6,29 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/14 15:08:35 by charles #+# #+# */ -/* Updated: 2020/04/15 10:06:04 by charles ### ########.fr */ +/* Updated: 2020/11/12 15:38:55 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "Squad.hpp" -Squad::Squad() : m_units(new ISpaceMarine*[0]), m_size(0) -{ -} +Squad::Squad() : m_units(new ISpaceMarine*[0]), m_size(0) {} -Squad::Squad(Squad const& other) -{ - *this = other; -} +Squad::Squad(Squad const& other) { *this = other; } -void Squad::operator=(Squad const& other) +Squad& Squad::operator=(Squad const& other) { destroyUnits(); m_size = other.m_size; m_units = new ISpaceMarine*[m_size]; for (int i = 0; i < m_size; i++) m_units[i] = other.m_units[i]->clone(); + return *this; } -Squad::~Squad() -{ - destroyUnits(); -} +Squad::~Squad() { destroyUnits(); } -int Squad::getCount() const -{ - return m_size; -} +int Squad::getCount() const { return m_size; } ISpaceMarine* Squad::getUnit(int n) const { |
