mirror of
https://github.com/Ladebeze66/cpp-partie-2.git
synced 2026-11-09 13:47:14 +01:00
00
This commit is contained in:
@@ -6,13 +6,18 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/11 14:39:51 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/02/22 12:48:40 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/03/11 14:47:49 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Bureaucrat.hpp"
|
||||
#include "Form.hpp"
|
||||
|
||||
Form::Form() : name("default"), isSigned(false), gradeRequiredToSign(150), gradeRequiredToExecute(150)
|
||||
{
|
||||
std::cout << GREEN << "Form default constructor called!" << RESET << std::endl;
|
||||
}
|
||||
|
||||
Form::Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute)
|
||||
: name(name), isSigned(false), gradeRequiredToSign(gradeRequiredToSign), gradeRequiredToExecute(gradeRequiredToExecute)
|
||||
{
|
||||
@@ -24,6 +29,7 @@ Form::Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredTo
|
||||
{
|
||||
throw GradeTooLowException();
|
||||
}
|
||||
std::cout << GREEN << "Form" << this->name << "constructor called with grade to sign: " << this->gradeRequiredToSign << " and grade to execute: " << this->gradeRequiredToExecute << RESET << std::endl;
|
||||
}
|
||||
|
||||
Form::Form(const Form& other)
|
||||
|
||||
@@ -6,38 +6,37 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/11 14:37:14 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/02/26 15:57:56 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/03/11 15:07:38 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FORM_HPP
|
||||
#define FORM_HPP
|
||||
|
||||
#include "Bureaucrat.hpp" // Assurez-vous que cette classe est bien définie
|
||||
#include "Bureaucrat.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class Bureaucrat;
|
||||
|
||||
class AForm
|
||||
class Form
|
||||
{
|
||||
private:
|
||||
const std::string name;
|
||||
const
|
||||
bool isSigned;
|
||||
const int gradeRequiredToSign;
|
||||
const int gradeRequiredToExecute;
|
||||
|
||||
public:
|
||||
//constructueur
|
||||
AForm(const::std::string& name);
|
||||
AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute);
|
||||
Form();
|
||||
Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute);
|
||||
// Constructeur par copie
|
||||
AForm(const AForm& other);
|
||||
Form(const Form& other);
|
||||
// Opérateur d'affectation
|
||||
AForm& operator=(const AForm& other);
|
||||
Form& operator=(const Form& other);
|
||||
// Destructeur
|
||||
~AForm();
|
||||
~Form();
|
||||
|
||||
|
||||
std::string getName() const;
|
||||
@@ -50,23 +49,17 @@ public:
|
||||
class GradeTooHighException : public std::exception
|
||||
{
|
||||
public:
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
return ("Grade too high");
|
||||
}
|
||||
const char* what() const throw();
|
||||
};
|
||||
|
||||
class GradeTooLowException : public std::exception
|
||||
{
|
||||
public:
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
return ("Grade too low");
|
||||
}
|
||||
const char* what() const throw();
|
||||
};
|
||||
};
|
||||
|
||||
// Surcharge de l'opérateur d'insertion
|
||||
std::ostream& operator<<(std::ostream& os, const AForm& form);
|
||||
std::ostream& operator<<(std::ostream& os, const Form& form);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user