-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleJourney.cpp
47 lines (38 loc) · 1.72 KB
/
simpleJourney.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
45
46
47
/*************************************************************************
SimpleJourney - description
-------------------
début : 27/11/2023
copyright : (C) 2023 par Jixiang, Adam, Clément, Louis
binome : B3311 et B3309
*************************************************************************/
//- Réalisation de la classe <SimpleJourney> (fichier SimpleJourney.cpp) -
//---------------------------------------------------------------- INCLUDE
//------------------------------------------------------ Include personnel
#include "simpleJourney.h"
//----------------------------------------------------------------- PUBLIC
//----------------------------------------------------- Méthodes publiques
void SimpleJourney::show(void) const
// Algorithme :
// Show the journey
// The format is : from --(transportMethod)-> to
{
std::cout << _from << " --(" << _transportMethod << ")-> " << _to;
} //----- Fin de show
//-------------------------------------------- Constructeurs - destructeur
SimpleJourney::SimpleJourney(const char *start, const char *end, const char *transportMethod)
: Journey(start, end), _transportMethod(strdup(transportMethod)) {
#ifdef MAP
std::cout << "Constructor called for <SimpleJourney>" << std::endl;
#endif
}
SimpleJourney::~SimpleJourney()
// 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 <SimpleJourney>" << std::endl;
#endif
free((char *)_transportMethod);
} //----- Fin de ~SimpleJourney