aboutsummaryrefslogtreecommitdiff
path: root/cpp01/ex00/Pony.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp01/ex00/Pony.cpp')
-rw-r--r--cpp01/ex00/Pony.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/cpp01/ex00/Pony.cpp b/cpp01/ex00/Pony.cpp
index b45f0e1..1b8df61 100644
--- a/cpp01/ex00/Pony.cpp
+++ b/cpp01/ex00/Pony.cpp
@@ -6,28 +6,34 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 09:06:06 by charles #+# #+# */
-/* Updated: 2020/04/13 09:33:59 by charles ### ########.fr */
+/* Updated: 2020/11/09 09:57:26 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include <iostream>
#include "Pony.hpp"
-Pony::Pony(int weight, int maxSpeed)
- : m_weight(weight), m_maxSpeed(maxSpeed)
+Pony::Pony(std::string const& name, int weight, int maxSpeed)
+ : m_name(name), m_weight(weight), m_maxSpeed(maxSpeed)
{
+ std::cout << "Hey there, my name is " << m_name << " and you?" << std::endl;
+}
+
+Pony::~Pony()
+{
+ std::cout << "Oh no, I'M DYING! They called me " << m_name << "." << std::endl;
}
void Pony::sayHello()
{
- std::cout << "Hi, I'm a pony, I weight " << m_weight
- << " and my speed limit is " << m_maxSpeed
+ std::cout << "Hi, I'm " << m_name
+ << ", I weight " << m_weight
+ << " and my speed limit is " << m_maxSpeed
<< std::endl;
}
void Pony::run()
{
for (int i = 0; i <= m_maxSpeed; i += m_maxSpeed / 10)
- std::cout << "I'm running really fast at " << i
- << ", look at me!" << std::endl;
+ std::cout << m_name << " is running really fast at " << i
+ << ", look at him!" << std::endl;
}