-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjourney.cpp
44 lines (36 loc) · 1.6 KB
/
journey.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*************************************************************************
journey
-------------------
début : 27/11/2023
copyright : (C) 2023 par Jixiang, Adam, Clément, Louis
binome : B3311 et B3309
*************************************************************************/
//---------- Réalisation de la classe <journey> (fichier journey.cpp) ----------
//---------------------------------------------------------------- INCLUDE
//-------------------------------------------------------- Include système
#include "journey.h"
using std::ostream;
//----------------------------------------------------------------- PUBLIC
//----------------------------------------------------- Méthodes publiques
Journey::~Journey()
// Algorithme :
// Free the memory allocated by strdup()
// Using free instead of delete because the string was created with strdup(),
// which require a free
{
#ifdef MAP
std::cout << "Destructor called for <Journey>" << std::endl;
#endif
free((char *)_from);
free((char *)_to);
} //----- Fin de ~Journey
//------------------------------------------------- Surcharge d'opérateurs
ostream &operator<<(ostream &os, const Journey &journey) {
journey.show();
return os;
} //----- Fin de operator <<
//------------------------------------------------------------------ PRIVE
//----------------------------------------------------- Méthodes protégées
void Journey::show(void) const {
std::cout << _from << " --> " << _to;
} //----- Fin de show