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.

53 lines
1.8 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/24 13:06:55 by narnaud #+# #+# */
3 years ago
/* Updated: 2022/06/26 16:00:43 by narnaud ### ########.fr */
3 years ago
/* */
/* ************************************************************************** */
#pragma once
#include <string>
#include <iostream>
#include <stdexcept>
using std::cout;
using std::endl;
using std::string;
class Bureaucrat{
string _name;
3 years ago
int _grade;
3 years ago
public:
class GradeTooHighException: virtual public std::exception
{
3 years ago
public:
const char *what(void) const throw ();
3 years ago
};
class GradeTooLowException: virtual public std::exception
{
3 years ago
public:
const char *what(void) const throw ();
3 years ago
};
3 years ago
Bureaucrat(void);
Bureaucrat(const string name, int grade)
throw (GradeTooHighException, GradeTooLowException);
Bureaucrat(Bureaucrat const & src);
virtual ~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);
3 years ago
};
std::ostream &operator<< (std::ostream &out, Bureaucrat const &b);