Adding comments
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
|
||||
#include "Bureaucrat.hpp"
|
||||
|
||||
//////////////////
|
||||
//Constructores //
|
||||
//////////////////
|
||||
|
||||
Bureaucrat::Bureaucrat() : name("NULL"), grade(150)
|
||||
{
|
||||
//std::cout << "Bureaucrat has been created" << std::endl;
|
||||
@@ -45,6 +49,11 @@ Bureaucrat::Bureaucrat(std::string name, int grade) : name(name)
|
||||
//std::cout << "Bureaucrat with params has been created" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Getters //
|
||||
//////////////////
|
||||
|
||||
std::string Bureaucrat::getName() const
|
||||
{
|
||||
return (this->name);
|
||||
@@ -55,6 +64,11 @@ int Bureaucrat::getGrade() const
|
||||
return (this->grade);
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Grade //
|
||||
//////////////////
|
||||
|
||||
void Bureaucrat::incrementGrade()
|
||||
{
|
||||
if (this->grade <= 1)
|
||||
@@ -69,6 +83,25 @@ void Bureaucrat::decrementGrade()
|
||||
this->grade++;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// << //
|
||||
//////////////////
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const Bureaucrat &bureaucrat)
|
||||
{
|
||||
os << bureaucrat.getName()
|
||||
<< ", bureaucrat grade "
|
||||
<< bureaucrat.getGrade()
|
||||
<< std::endl;
|
||||
return (os);
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Excepciones //
|
||||
//////////////////
|
||||
|
||||
const char* Bureaucrat::GradeTooHighException::what() const throw()
|
||||
{
|
||||
return ("Grade is too high!");
|
||||
@@ -78,12 +111,3 @@ const char* Bureaucrat::GradeTooLowException::what() const throw()
|
||||
{
|
||||
return ("Grade is too low!");
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const Bureaucrat &bureaucrat)
|
||||
{
|
||||
os << bureaucrat.getName()
|
||||
<< ", bureaucrat grade "
|
||||
<< bureaucrat.getGrade()
|
||||
<< std::endl;
|
||||
return (os);
|
||||
}
|
||||
Reference in New Issue
Block a user