This module explores C++ exceptions, abstract classes, inheritance, and factory patterns through a humorous bureaucracy simulation with Bureaucrats, Forms, and Interns.
For each exercise, navigate to its folder, compile, and run:
π ex00
cd ex00
make
./ex00
π ex01
cd ex01
make
./ex01
π ex02
cd ex02
make
./ex02
π ex03
cd ex03
make
./ex03
ex00 β Mommy, when I grow up, I want to be a bureaucrat!: Implement a Bureaucrat class with constant name and grade (1β150). Add grade increment/decrement, exceptions, and a stream insertion (<<) overload.
ex01 β Form up, maggots!: Add a Form class requiring a grade to sign and execute. Bureaucrats can sign forms if their grade is high enough.
ex02 β No, you need form 28B, not 28C...: Create an abstract AForm base class and concrete forms: ShrubberyCreationForm, RobotomyRequestForm, and PresidentialPardonForm, each with unique behaviors and grade requirements. Implement form execution and error handling.
ex03 β At least this beats coffee-making: Implement an Intern class with a makeForm() factory function that creates forms by name. Avoid ugly if/else chains; use elegant design.
If you have any questions or suggestions, feel free to connect: π LinkedIn: Valentina Nguyen πββοΈ
This project was developed and tested on Linux (Ubuntu).