Add unique_id for tasks
This commit is contained in:
parent
4a89dd5a44
commit
477f73d4c4
2 changed files with 11 additions and 3 deletions
|
@ -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:
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Reference in a new issue