Téléverser les fichiers vers "/"

This commit is contained in:
2026-02-20 15:18:00 +00:00
parent 5090daa1e0
commit 1e5def6c1b
2 changed files with 52 additions and 0 deletions

21
User.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "User.h"
#include <iostream>
User::User(int id, const std::string& username, const std::string& password)
: id(id), username(username), password(password) {}
int User::getId() const { return id; }
std::string User::getUsername() const { return username; }
std::string User::getPassword() const { return password; }
Role User::getRole() const { return role; }
void User::displayMenu() const {
std::cout << "Menu pour " << username << " (role = ";
if(role == Role::ADMIN) std::cout << "ADMIN";
else if(role == Role::PROF) std::cout << "PROF";
else std::cout << "STUDENT";
std::cout << ")\n";
}

31
User.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef USER_H
#define USER_H
#include <string>
enum class Role {
ADMIN,
PROF,
STUDENT
};
class User {
protected:
int id;
std::string username;
std::string passwordHash;
Role role;
public:
User(int id, const std::string& username, const std::string& passwordHash, Role role);
virtual ~User() = default;
int getId() const;
std::string getUsername() const;
Role getRole() const;
virtual void displayMenu() const = 0;
};
#endif