56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#include "AForm.hpp"
|
|
#include "Bureaucrat.hpp"
|
|
#include "PresidentialPardonForm.hpp"
|
|
#include "RobotomyRequestForm.hpp"
|
|
#include "ShrubberyCreationForm.hpp"
|
|
#include "intern.hpp"
|
|
|
|
int main(void)
|
|
{
|
|
srand(time(NULL));
|
|
|
|
std::cout << "\033[34m" << std::endl << "Test ex02" << "\033[0m" << std::endl;
|
|
|
|
std::cout << "\033[35m" << std::endl << "Test ex02 ShrubberyCreationForm" << "\033[0m" << std::endl;
|
|
Bureaucrat Mr_Shrubby("Mr_Shrubby", 130);
|
|
ShrubberyCreationForm Shrubby_form("Hello");
|
|
std::cout << std::endl;
|
|
std::cout << Shrubby_form;
|
|
Mr_Shrubby.signForm(Shrubby_form);
|
|
std::cout << Shrubby_form;
|
|
Mr_Shrubby.executeForm(Shrubby_form);
|
|
|
|
std::cout << "\033[32m" << std::endl << "Test ex02 RobotomyRequestForm" << "\033[0m" << std::endl;
|
|
RobotomyRequestForm Robo_form("I am a robo form");
|
|
Bureaucrat Mr_Robo("Mr_Robo", 45);
|
|
|
|
Mr_Robo.executeForm(Robo_form);
|
|
Mr_Robo.signForm(Robo_form);
|
|
Mr_Robo.executeForm(Robo_form);
|
|
Mr_Robo.executeForm(Robo_form);
|
|
Mr_Robo.executeForm(Robo_form);
|
|
|
|
std::cout << "\033[33m" << std::endl << "Test ex02 PresidentialPardonForm" << "\033[0m" << std::endl;
|
|
PresidentialPardonForm President_form("I am a robo form");
|
|
Bureaucrat Mr_President("Mr_President", 5);
|
|
|
|
Mr_Robo.executeForm(President_form);
|
|
Mr_Robo.signForm(President_form);
|
|
|
|
Mr_President.executeForm(President_form);
|
|
Mr_President.signForm(President_form);
|
|
Mr_President.executeForm(President_form);
|
|
|
|
std::cout << "\033[33m" << std::endl << "Test ex03 Intern" << "\033[0m" << std::endl;
|
|
|
|
Intern intern;
|
|
AForm *roboto;
|
|
|
|
roboto = intern.makeForm("DoYouKnowMe", "Hmmmm");
|
|
roboto = intern.makeForm("RobotomyRequestForm", "World");
|
|
|
|
std::cout << roboto->getName() << std::endl;
|
|
delete roboto;
|
|
return (0);
|
|
}
|