Something went wrong. Try again.
Java--'s try/catch projects.intra.42.fr/projects/cpp-module-05
Something went wrong. Try again.
1.0 kB · 49 lines
C++
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#pragma once
#include <iostream>#include <ostream>#include <string>
class Bureaucrat;
class Form { public: Form(); Form(const Form& other); Form(const std::string& name); Form(const std::string& name, const unsigned short gradeToSign, const unsigned short gradeToExecute);
void beSigned(Bureaucrat& bureaucrat);
const std::string& getName() const; bool getIsSigned() const; unsigned short getGradeToSign() const; unsigned short getGradeToExecute() const;
Form& operator=(const Form& other);
virtual ~Form(); private: const std::string name;
bool isSigned;
const unsigned short gradeToSign; const unsigned short gradeToExecute;
class GradeTooHighException : public std::exception { public: const char* what() const throw() { return "Grade too high"; } };
class GradeTooLowException : public std::exception { public: const char* what() const throw() { return "Grade too low"; } };};
std::ostream& operator<<(std::ostream& ostream, const Form& form);