From d82989ee9fae31d0a399af9b80f03a9ebbcf1ae5 Mon Sep 17 00:00:00 2001 From: malanone Date: Tue, 22 Mar 2022 16:22:49 +0000 Subject: [PATCH] Update Contact.cpp --- src/Contact.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Contact.cpp b/src/Contact.cpp index 2cced8f..001d269 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -51,12 +51,23 @@ bool Contact::rechercher(const Personne& unContact){ lesContacts.sort(); } -// bool Contact::supprimerContact(const Personne& unContact){ -// //remove -// } +bool Contact::supprimerContact(const Personne& unContact){ + list::iterator it = find(lesContacts.begin(), lesContacts.end(), &unContact); + if(it!=lesContacts.end()){ + lesContacts.erase(it); + cout << "Contact " << unContact << " supprimé\n"; + return true; + } + else { + cout << "Erreur : le contact n'existe pas\n"; + return false; + } +} -// string envoyerMessage(std::string texte, Personne p) +void Contact::envoyerMessage(std::string texte, Personne p){ + +} // string recevoirMessage(std::string texte, Personne p)