Update Contact.cpp

main
Joan PIERRON 3 years ago
parent 1808f53cd0
commit 6b4d73c432

@ -6,8 +6,6 @@
using namespace std;
using namespace reseau;
// list<Personne>::iterator it = find(lesContacts.begin(), lesContacts.end(), personne)
Contact::Contact(const Personne& Proprietaire): Proprietaire{Proprietaire} {
cout << "Contact créé " << Proprietaire << "\n";
}
@ -64,23 +62,30 @@ bool Contact::supprimerContact(const Personne& unContact){
}
}
void Contact::envoyerMessage(std::string texte, Personne p){
void Contact::afficherContactDirect() {
cout << lesContacts.size() << " Les contacts directs de " << this->Proprietaire << " sont : ";
for(list<const Personne*>::const_iterator it = lesContacts.cbegin(); it != lesContacts.cend(); ++it){
if(it==lesContacts.cbegin())
cout << **it;
else
cout << ", " << **it;
}
cout << "\n";
}
// string recevoirMessage(std::string texte, Personne p)
void Contact::afficherContactIndirect() {
cout << lesContacts.size() << " Les contacts directs et indirects de " << this->Proprietaire << " sont : ";
if(lesContacts.size()==0)
cout << " Aucun contact ";
cout << "\n";
}
ostream& reseau::operator<<(ostream& os, Personne p){
return os << p.getNom() << " " << p.getPrenom() << " " << p.getNumTel();
return os << p.getPrenom();
}
bool reseau::operator==(reseau::Personne p1, reseau::Personne p2){
if(p1.getNom()==p2.getNom()){
if(p1.getPrenom()==p2.getPrenom()){
if(p1.getNumTel()==p2.getNumTel())
if(p1.getPrenom()==p2.getPrenom())
return true;
}
}
return false;
}

Loading…
Cancel
Save