Skip to content

natamun/42-cpp05

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42-cpp05

The sixth C++ module of the 42 curriculum, focused on repetition and exceptions.

This project introduces exception handling, abstract classes, and inheritance chains, building a bureaucratic system where forms can be created, signed, and executed by bureaucrats of varying grades.

Usage

Each exercise (ex00 to ex03) contains its own Makefile. Compile and run individually:

cd ex00
make
./bureaucrat

Exercises

  • ex00: Bureaucrat class with grade validation using custom exceptions inheriting from std::exception.
  • ex01: Form class with grade requirements for signing, and signForm() / beSigned() interaction.
  • ex02: Abstract AForm base class with pure virtual execute(), and three concrete forms: ShrubberyCreationForm, RobotomyRequestForm, PresidentialPardonForm.
  • ex03: Intern class with a makeForm() factory using an array of function pointers to avoid if/else chains.

Code Structure

Each exercise is self-contained in its own directory with its own source files, headers, and Makefile, following the standard 42 module layout.

About

Exceptions and abstract classes in C++: bureaucrats, forms, and a factory pattern

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors