Add unique_id for tasks

This commit is contained in:
Mylloon 2023-10-21 15:47:15 +02:00
parent 4a89dd5a44
commit 477f73d4c4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 11 additions and 3 deletions

View file

@ -4,6 +4,8 @@
#include <iostream> #include <iostream>
class Tache { class Tache {
static int unique_id;
friend std::ostream &operator<<(std::ostream &, const Tache &); friend std::ostream &operator<<(std::ostream &, const Tache &);
public: public:

View file

@ -1,10 +1,16 @@
#include "../includes/Tache.hpp" #include "../includes/Tache.hpp"
Tache::Tache() { std::cout << "Hello, tache!\n"; } int Tache::unique_id = 0;
Tache::~Tache() {} Tache::Tache() {
++unique_id;
Tache::Tache(const Tache &) {} std::cout << "Hello, tache!\n";
}
Tache::~Tache() { --unique_id; }
Tache::Tache(const Tache &) { ++unique_id; }
const Tache &Tache::operator=(const Tache &src) { const Tache &Tache::operator=(const Tache &src) {
if (this == &src) { if (this == &src) {