Delete Personne2.cpp

main
Joan PIERRON 3 years ago
parent 68465eedb8
commit 7f0bccf5f2

@ -1,54 +0,0 @@
#include <iostream>
#include <list>
#include "Personne2.h"
using namespace std;
using namespace reseau2;
list<Personne> Personne::listePersonneAll{};
Personne::Personne(const string& prenom): prenom{prenom}{
listePersonneAll.emplace_back(*this);
cout << prenom << " créé\n";
}
const string& Personne::getPrenom() const {
return this->prenom;
}
bool Personne::ajoutListe(const Personne& unePersonne) {
if(allPerson.empty()){
cout << "Personne ajoutée " << unePersonne <<"\n";
allPerson.push_back(unePersonne);
return true;
}
if(unePersonne.getPrenom()==this->prenom)
return false;
else {
cout << "Personne ajoutée " << unePersonne <<"\n";
allPerson.push_back(unePersonne);
return true;
}
}
void Personne::affichListe() {
cout<<"("<<this->getPrenom()<<") : ";
for(list<Personne>::const_iterator it2 = allPerson.cbegin(); it2 != allPerson.cend(); ++it2)
cout << *it2 << " ";
cout << "\n";
}
ostream& reseau2::operator<<(ostream& os, Personne p) {
return os << p.getPrenom();
}
bool reseau2::operator==(Personne p1, Personne p2){
if(p1.getPrenom()==p2.getPrenom())
return true;
return false;
}
Personne::~Personne() {}
Loading…
Cancel
Save