fix: changing rank to integer

This commit is contained in:
Raphael 2025-03-16 22:19:58 +01:00
parent 19ffc5d295
commit 0e3f3a6e3b
3 changed files with 16 additions and 8 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/16 14:48:33 by rparodi #+# #+# */
/* Updated: 2025/03/16 22:01:02 by rparodi ### ########.fr */
/* Updated: 2025/03/16 22:16:36 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,15 +16,21 @@
#include <string>
#include <iostream>
#define RESET "\033[0m"
#define YELLOW "\033[0;33m"
#define RED "\033[0;31m"
class Bureaucrat {
public:
Bureaucrat(void);
Bureaucrat(std::string name, u_int8_t grade);
Bureaucrat(std::string name, int grade);
Bureaucrat(Bureaucrat const &copy);
Bureaucrat& operator=(Bureaucrat const &assign);
~Bureaucrat(void);
std::string getName(void) const;
u_int8_t getGrade(void) const;
int getGrade(void) const;
void promote(void);
void demote(void);
class GradeTooHighException : public std::exception {
virtual const char *what() const throw() {
return ("Error:\n> Grade is too high (have to be lower than 1)");
@ -37,7 +43,7 @@ class Bureaucrat {
};
private:
std::string _name;
u_int8_t _grade;
int _grade;
};
std::ostream& operator<<(std::ostream& os, Bureaucrat const &bureaucrat);