Files
cpp05/ex03/main.cpp
2025-08-02 13:51:40 +02:00

68 lines
2.0 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/19 01:13:45 by mmoussou #+# #+# */
/* Updated: 2025/08/02 13:49:12 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ShrubberyCreationForm.hpp"
#include "RobotomyRequestForm.hpp"
#include "PresidentialPardonForm.hpp"
#include "Intern.hpp"
#include "Bureaucrat.hpp"
int main(void)
{
/*try
{
}
catch (std::exception& e)
{
std::cout << "Exception : " << e.what() << std::endl;
}
std::cout << std::endl;*/
try
{
Intern john;
john.makeForm("the ultimate form", "the ARK");
delete john.makeForm("shrubbery request", "home");
delete john.makeForm("robotomy request", "test subject 727");
delete john.makeForm("presidential pardon request", "you");
john.makeForm("", "");
}
catch (std::exception& e)
{
std::cout << "Exception : " << e.what() << std::endl;
}
std::cout << std::endl;
try
{
Intern john;
Bureaucrat knl("Kanel", 72);
Bureaucrat brc("john", 1);
AForm *form = john.makeForm("robotomy request", "Bender");
knl.signForm(*form);
std::cout << "still 50% chances of working" << std::endl;
brc.executeForm(*form);
brc.executeForm(*form);
brc.executeForm(*form);
brc.executeForm(*form);
brc.executeForm(*form);
}
catch (std::exception& e)
{
std::cout << "Exception : " << e.what() << std::endl;
}
std::cout << std::endl;
}