diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-14 20:42:26 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-14 20:42:26 +0200 |
| commit | 7ac812044bfe771178752a52d70b18bb297c1891 (patch) | |
| tree | 5f5faf0d627304cdfe1f1f45194b3da76653fff8 /cpp05/ex01/Bureaucrat.hpp | |
| parent | efea8712aaf8169b1184cceb83705ca6b8783173 (diff) | |
| download | piscine_cpp-7ac812044bfe771178752a52d70b18bb297c1891.tar.gz piscine_cpp-7ac812044bfe771178752a52d70b18bb297c1891.tar.bz2 piscine_cpp-7ac812044bfe771178752a52d70b18bb297c1891.zip | |
cpp07 done, cpp06 ex00 and ex01 start
Diffstat (limited to 'cpp05/ex01/Bureaucrat.hpp')
| -rw-r--r-- | cpp05/ex01/Bureaucrat.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/cpp05/ex01/Bureaucrat.hpp b/cpp05/ex01/Bureaucrat.hpp new file mode 100644 index 0000000..ff8bb2e --- /dev/null +++ b/cpp05/ex01/Bureaucrat.hpp @@ -0,0 +1,62 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Bureaucrat.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/14 18:04:32 by charles #+# #+# */ +/* Updated: 2020/04/14 19:37:05 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef BUREAUCRAT_HPP +# define BUREAUCRAT_HPP + +# include <iostream> +# include <exception> + +class Bureaucrat +{ +public: + Bureaucrat(Bureaucrat const& other); + void operator=(Bureaucrat const& other); + ~Bureaucrat(); + + Bureaucrat(std::string const& name, int grade); + std::string const& getName() const; + int getGrade() const; + void incrementGrade(); + void decrementGrade(); + // signForm(); + + class GradeTooHighException : public std::exception + { + public: + GradeTooHighException(); + GradeTooHighException(GradeTooHighException const& other); + void operator=(GradeTooHighException const& other); + ~GradeTooHighException(); + virtual char const* what() const throw(); + }; + + class GradeTooLowException : public std::exception + { + public: + GradeTooLowException(); + GradeTooLowException(GradeTooLowException const& other); + void operator=(GradeTooLowException const& other); + ~GradeTooLowException(); + virtual char const* what() const throw(); + }; + +private: + Bureaucrat(); + + std::string const m_name; + int m_grade; +}; + +std::ostream& operator<<(std::ostream& out, Bureaucrat const& b); + +#endif |
