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/ex00/Victim.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'cpp04/ex00/Victim.cpp') diff --git a/cpp04/ex00/Victim.cpp b/cpp04/ex00/Victim.cpp index 2f2f6ad..97db6ff 100644 --- a/cpp04/ex00/Victim.cpp +++ b/cpp04/ex00/Victim.cpp @@ -6,46 +6,40 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 20:42:22 by charles #+# #+# */ -/* Updated: 2020/04/13 20:59:51 by charles ### ########.fr */ +/* Updated: 2020/11/12 12:59:36 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "Victim.hpp" -Victim::Victim(std::string name) : - m_name(name) +Victim::Victim(std::string const& name) : m_name(name) { - std::cout << "Some random victim called " << name << " just appeared!" << std::endl; + std::cout << "Some random victim called " << name + << " just appeared!" << std::endl; } -void Victim::operator=(Victim const& other) +Victim& Victim::operator=(Victim const& other) { m_name = other.m_name; + return *this; } -Victim::Victim(Victim const& other) -{ - *this = other; -} +Victim::Victim(Victim const& other) { *this = other; } Victim::~Victim() { - std::cout << "Victim " << m_name << " just died for no apparent reason!" << std::endl; + std::cout << "Victim " << m_name + << " just died for no apparent reason!" << std::endl; } -std::string const& Victim::getName() const -{ - return m_name; -} +std::string const& Victim::getName() const { return m_name; } void Victim::getPolymorphed() const { std::cout << m_name << " has been turned into a cute little sheep!" << std::endl; } -Victim::Victim() -{ -} +Victim::Victim() {} std::ostream& operator<<(std::ostream& out, Victim const& v) { -- cgit