aboutsummaryrefslogtreecommitdiff
path: root/cpp04/ex00/Victim.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-12 15:46:07 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-12 15:46:07 +0100
commitb8e39b947890e74d82530e25ad9d02668aae1f0c (patch)
treef59acfdecb0711137c200a4c5acb854e351f9cf9 /cpp04/ex00/Victim.cpp
parent96dcf214a8c40529b251ea31ef037868583dd1da (diff)
downloadpiscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.tar.gz
piscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.tar.bz2
piscine_cpp-b8e39b947890e74d82530e25ad9d02668aae1f0c.zip
Reformating cpp04 classes
Diffstat (limited to 'cpp04/ex00/Victim.cpp')
-rw-r--r--cpp04/ex00/Victim.cpp28
1 files changed, 11 insertions, 17 deletions
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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{