aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex03/Bureaucrat.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-12-12 12:33:39 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-12-12 12:33:39 +0100
commit0071b1e944cbce91ff6ff8e235280c3955ce1d5b (patch)
treeaf908c41fc051002311f50e8f73b889769a5279e /cpp05/ex03/Bureaucrat.cpp
parentc10aa969c60cedef893146307fa319250901465a (diff)
downloadpiscine_cpp-0071b1e944cbce91ff6ff8e235280c3955ce1d5b.tar.gz
piscine_cpp-0071b1e944cbce91ff6ff8e235280c3955ce1d5b.tar.bz2
piscine_cpp-0071b1e944cbce91ff6ff8e235280c3955ce1d5b.zip
Fixing cpp05 small errors
Diffstat (limited to 'cpp05/ex03/Bureaucrat.cpp')
-rw-r--r--cpp05/ex03/Bureaucrat.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/cpp05/ex03/Bureaucrat.cpp b/cpp05/ex03/Bureaucrat.cpp
index 64bbd25..7274f6b 100644
--- a/cpp05/ex03/Bureaucrat.cpp
+++ b/cpp05/ex03/Bureaucrat.cpp
@@ -6,17 +6,18 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/14 18:08:13 by charles #+# #+# */
-/* Updated: 2020/11/17 13:37:49 by cacharle ### ########.fr */
+/* Updated: 2020/12/12 12:21:27 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "Bureaucrat.hpp"
-Bureaucrat::Bureaucrat(Bureaucrat const& other) { *this = other; }
+Bureaucrat::Bureaucrat(Bureaucrat const& other)
+ : m_name(other.m_name) { *this = other; }
Bureaucrat& Bureaucrat::operator=(Bureaucrat const& other)
{
- m_name = other.m_name;
+ // m_name = other.m_name;
m_grade = other.m_grade;
return *this;
}
@@ -44,7 +45,7 @@ void Bureaucrat::decrementGrade()
checkGrade();
}
-void Bureaucrat::signForm(Form& form)
+void Bureaucrat::signForm(Form& form) const
{
try
{
@@ -53,11 +54,11 @@ void Bureaucrat::signForm(Form& form)
}
catch (std::exception &e)
{
- std::cout << m_name << " cannot sign " << form.getName() << " " << e.what() << std::endl;
+ std::cout << m_name << " cannot sign " << form.getName() << " because " << e.what() << std::endl;
}
}
-void Bureaucrat::executeForm(Form& form)
+void Bureaucrat::executeForm(Form const& form) const
{
try
{
@@ -66,7 +67,7 @@ void Bureaucrat::executeForm(Form& form)
}
catch (std::exception &e)
{
- std::cout << m_name << " cannot execute " << form.getName() << " " << e.what() << std::endl;
+ std::cout << m_name << " cannot execute " << form.getName() << " because " << e.what() << std::endl;
}
}