「🔨」 fix: fixed Form class from ex01
This commit is contained in:
@ -6,11 +6,13 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 13:59:45 by adjoly #+# #+# */
|
||||
/* Updated: 2025/03/29 14:58:52 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/01 10:49:43 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Bureaucrat.hpp"
|
||||
#include "Form.hpp"
|
||||
#include <exception>
|
||||
|
||||
void _log(std::string emoji, std::string what, std::string who,
|
||||
std::string str) {
|
||||
@ -40,8 +42,8 @@ Bureaucrat::Bureaucrat(std::string name, uint8_t grade)
|
||||
_log("➕", "Bureaucrat", "", "constructor called");
|
||||
}
|
||||
|
||||
const std::string &Bureaucrat::getName(void) { return _name; }
|
||||
uint8_t Bureaucrat::getGrade(void) { return _grade; }
|
||||
const std::string &Bureaucrat::getName(void) const { return _name; }
|
||||
uint8_t Bureaucrat::getGrade(void) const { return _grade; }
|
||||
|
||||
Bureaucrat::~Bureaucrat(void) {
|
||||
_log("➖", "Bureaucrat", "", "destructor called");
|
||||
@ -92,10 +94,18 @@ std::ostream &operator<<(std::ostream &os, Bureaucrat &val) {
|
||||
}
|
||||
|
||||
const char *Bureaucrat::GradeTooHighException::what() const throw() {
|
||||
return ("Grade is too high");
|
||||
}
|
||||
return ("Grade is too high");
|
||||
}
|
||||
|
||||
const char *Bureaucrat::GradeTooLowException::what() const throw() {
|
||||
return ("Grade is too low");
|
||||
}
|
||||
return ("Grade is too low");
|
||||
}
|
||||
|
||||
void Bureaucrat::signForm(Form &f) {
|
||||
try {
|
||||
f.beSigned(*this);
|
||||
std::cout << _name << " signed " << f.getName() << std::endl;
|
||||
} catch (std::exception &e) {
|
||||
std::cout << _name << " counldn't sign " << f.getName() << " because " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user