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/ex02/Squad.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'cpp04/ex02/Squad.cpp') 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 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 { -- cgit