You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.8 KiB
47 lines
1.8 KiB
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Bureaucrat.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/06/24 13:06:55 by narnaud #+# #+# */
|
|
/* Updated: 2022/06/26 16:00:43 by narnaud ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
using std::cout;
|
|
using std::endl;
|
|
using std::string;
|
|
|
|
class Bureaucrat {
|
|
const string _name;
|
|
int _grade;
|
|
|
|
public:
|
|
class GradeTooHighException : virtual public std::exception {
|
|
public:
|
|
const char *what(void) const throw();
|
|
};
|
|
class GradeTooLowException : virtual public std::exception {
|
|
public:
|
|
const char *what(void) const throw();
|
|
};
|
|
Bureaucrat(void);
|
|
Bureaucrat(const string name, int grade) throw(GradeTooHighException,
|
|
GradeTooLowException);
|
|
Bureaucrat(Bureaucrat const &src);
|
|
~Bureaucrat(void);
|
|
Bureaucrat &operator=(Bureaucrat const &src);
|
|
const string getName(void) const;
|
|
int getGrade(void) const;
|
|
void incrGrade(int diff = 1) throw(GradeTooHighException);
|
|
void decrGrade(int diff = 1) throw(GradeTooLowException);
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &out, Bureaucrat const &b);
|
|
|