From 5c3d503b30304e8d2ec6a1db7442c7c7c5ba0d3e Mon Sep 17 00:00:00 2001 From: bray Date: Wed, 27 May 2020 09:59:21 +0200 Subject: [PATCH] beta 1.0 + operator --- app/include/Tortue.h | 4 ++++ app/src/Tortue.cpp | 5 +++++ sketch_ino.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/include/Tortue.h b/app/include/Tortue.h index b3ae3d6..e21d6e0 100644 --- a/app/include/Tortue.h +++ b/app/include/Tortue.h @@ -6,6 +6,7 @@ #define BE_TORTUE_H #include +#include class Tortue{ private: @@ -41,6 +42,9 @@ public: std::string getInfo(); static void delete1(); + + friend std::ostream &operator<<(std::ostream &os, const Tortue &tortue); + }; #endif //BE_TORTUE_H diff --git a/app/src/Tortue.cpp b/app/src/Tortue.cpp index 1926831..c48c663 100644 --- a/app/src/Tortue.cpp +++ b/app/src/Tortue.cpp @@ -138,5 +138,10 @@ void Tortue::delete1() { --nbTortue; } +ostream &operator<<(ostream &os, const Tortue &tortue) { + os << "nom: " << tortue.nom << " naissance: " << tortue.naissance << " sexe: " << tortue.sexe; + return os; +} + Tortue::ExceptionDate::ExceptionDate(int id) : id(id) {} diff --git a/sketch_ino.cpp b/sketch_ino.cpp index cebd271..a4d1efa 100644 --- a/sketch_ino.cpp +++ b/sketch_ino.cpp @@ -61,7 +61,7 @@ void Board::loop() { for (i = 0; i < 10; i++) { TemperatureManagement(); PressureManagement(); - + cout << tortues->back() << endl; if (menu->getId() == 0 && menu->displayDefault(temperature->getValue(), pressure->getValue(),