d05 ex02 ok pour Shrubbery form
This commit is contained in:
@@ -17,7 +17,8 @@ Bureaucrat::Bureaucrat( std::string name, int grade )
|
||||
return;
|
||||
}
|
||||
|
||||
Bureaucrat::Bureaucrat( Bureaucrat const & src ) {
|
||||
Bureaucrat::Bureaucrat( Bureaucrat const & src )
|
||||
: _name(src.getName()) {
|
||||
std::cout << COPLIEN_COLOR "Bureaucrat copy constructor" RESET "\n";
|
||||
*this = src;
|
||||
return;
|
||||
@@ -75,13 +76,31 @@ void Bureaucrat::gradeDown() {
|
||||
throw GradeTooLowException();
|
||||
}
|
||||
|
||||
void Bureaucrat::signForm( Form & f) {
|
||||
void Bureaucrat::signForm( AForm & f) {
|
||||
try {
|
||||
f.beSigned( *this );
|
||||
std::cout << _name << " signed " << f.getName() << "\n";
|
||||
std::cout << _name << " signed "
|
||||
<< f.getName() << "("
|
||||
<< f.getTarget() << ")\n";
|
||||
}
|
||||
catch (std::exception & e) {
|
||||
std::cout << _name << " couldn't sign " << f.getName()
|
||||
<< f.getName() << "("
|
||||
<< f.getTarget() << ")"
|
||||
<< " because [" << e.what() << "]\n";
|
||||
}
|
||||
}
|
||||
void Bureaucrat::executeForm( AForm const & f ) {
|
||||
try {
|
||||
f.execute( *this );
|
||||
std::cout << _name << " executed "
|
||||
<< f.getName() << "("
|
||||
<< f.getTarget() << ")\n";
|
||||
}
|
||||
catch (std::exception & e) {
|
||||
std::cout << _name << " couldn't execute "
|
||||
<< f.getName() << "("
|
||||
<< f.getTarget() << ")"
|
||||
<< " because [" << e.what() << "]\n";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user