diff --git a/user.h b/user.h new file mode 100644 index 0000000..6f502d7 --- /dev/null +++ b/user.h @@ -0,0 +1,62 @@ +#ifndef USER_H +#define USER_H + +#include +#include +#include + +// Classe de base (Abstraite) +class User { +protected: + int id; + std::string username; + std::string role; + +public: + User(int id, std::string name, std::string r) : id(id), username(name), role(r) {} + + // Cette fonction sera différente pour chaque rôle + virtual void showMenu() = 0; + + std::string getUsername() { return username; } + virtual ~User() {} +}; + +// --- Rôle ETUDIANT --- +class Student : public User { +public: + Student(int id, std::string name) : User(id, name, "Student") {} + void showMenu() override { + std::cout << "\n=== MENU ETUDIANT (" << username << ") ===" << std::endl; + std::cout << "1. Voir mes notes" << std::endl; + std::cout << "2. Contacter un prof" << std::endl; + std::cout << "0. Deconnexion" << std::endl; + } +}; + +// --- Rôle PROFESSEUR --- +class Prof : public User { +public: + Prof(int id, std::string name) : User(id, name, "Prof") {} + void showMenu() override { + std::cout << "\n=== MENU PROFESSEUR (" << username << ") ===" << std::endl; + std::cout << "1. Modifier une note" << std::endl; + std::cout << "2. Liste des etudiants" << std::endl; + std::cout << "0. Deconnexion" << std::endl; + } +}; + +// --- Rôle ADMIN --- +class Admin : public User { +public: + Admin(int id, std::string name) : User(id, name, "Admin") {} + void showMenu() override { + std::cout << "\n=== MENU ADMIN (" << username << ") ===" << std::endl; + std::cout << "1. Ajouter un utilisateur" << std::endl; + std::cout << "2. Supprimer un utilisateur" << std::endl; + std::cout << "3. Exporter les donnees (TXT)" << std::endl; + std::cout << "0. Deconnexion" << std::endl; + } +}; + +#endif \ No newline at end of file