2021-11-01 13:47:03 +01:00
|
|
|
#ifndef USER_H
|
|
|
|
#define USER_H
|
2021-10-27 15:15:47 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
class User {
|
2024-11-27 17:25:14 +01:00
|
|
|
public:
|
|
|
|
User() : cardNbr{0}, name{"default"} {}
|
|
|
|
User(int c, std::string n) : cardNbr{c}, name{n} {}
|
|
|
|
~User() {
|
|
|
|
cardNbr = -2;
|
|
|
|
name = "--------------------";
|
|
|
|
} // overwrite values for security reasons
|
|
|
|
User(const User &u) = default;
|
|
|
|
User &operator=(const User &) = default;
|
|
|
|
int getCardNbr() const { return cardNbr; }
|
|
|
|
std::string getName() const { return name; }
|
|
|
|
bool operator==(const User &u) const {
|
|
|
|
return cardNbr == u.cardNbr && name == u.name;
|
|
|
|
}
|
|
|
|
bool operator!=(const User &u) const { return !(u == *this); }
|
|
|
|
|
|
|
|
private:
|
2021-10-27 15:15:47 +02:00
|
|
|
int cardNbr;
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
2024-11-27 17:25:14 +01:00
|
|
|
std::ostream &operator<<(std::ostream &os, const User &u);
|
2021-10-27 15:15:47 +02:00
|
|
|
#endif
|