1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
|
8 |
|
|
#include "Shadok.h" |
9 |
|
|
|
10 |
|
|
///Default constructeur of Shadok |
11 |
|
7 |
Shadok::Shadok(){ |
12 |
✓ |
7 |
initialisationShadok(); |
13 |
|
7 |
} |
14 |
|
|
|
15 |
|
|
///Copy constructor of Shadok |
16 |
|
|
/** @param other : class to copy |
17 |
|
|
*/ |
18 |
|
1 |
Shadok::Shadok(const Shadok & other){ |
19 |
✓ |
1 |
copyShadok(other); |
20 |
|
1 |
} |
21 |
|
|
|
22 |
|
|
///Destructeur of Shadok |
23 |
|
16 |
Shadok::~Shadok(){ |
24 |
|
|
|
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
///Definition of equal operator of Shadok |
28 |
|
|
/** @param other : class to copy |
29 |
|
|
* @return copied class |
30 |
|
|
*/ |
31 |
|
1 |
Shadok & Shadok::operator = (const Shadok & other){ |
32 |
|
1 |
copyShadok(other); |
33 |
|
1 |
return *this; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
///Set the age of the Shadok |
37 |
|
|
/** @param age : age of the Shadok |
38 |
|
|
*/ |
39 |
|
3 |
void Shadok::setAge(int age){p_age = age;} |
40 |
|
|
|
41 |
|
|
///Set the name of the Shadok |
42 |
|
|
/** @param name : name of the Shadok |
43 |
|
|
*/ |
44 |
|
3 |
void Shadok::setName(const std::string & name){p_name = name;} |
45 |
|
|
|
46 |
|
|
///Get the age of the Shadok |
47 |
|
|
/** @return age of the Shadok |
48 |
|
|
*/ |
49 |
|
2 |
int Shadok::getAge() const{return p_age;} |
50 |
|
|
|
51 |
|
|
///Get the age of the Shadok |
52 |
|
|
/** @return age of the Shadok |
53 |
|
|
*/ |
54 |
|
6 |
int Shadok::getAge(){return p_age;} |
55 |
|
|
|
56 |
|
|
///Get the name of the Shadok |
57 |
|
|
/** @return name of the Shadok |
58 |
|
|
*/ |
59 |
|
2 |
const std::string & Shadok::getName() const{return p_name;} |
60 |
|
|
|
61 |
|
|
///Get the name of the Shadok |
62 |
|
|
/** @return name of the Shadok |
63 |
|
|
*/ |
64 |
|
4 |
std::string & Shadok::getName(){return p_name;} |
65 |
|
|
|
66 |
|
|
///Copy function of Shadok |
67 |
|
|
/** @param other : class to copy |
68 |
|
|
*/ |
69 |
|
2 |
void Shadok::copyShadok(const Shadok & other){ |
70 |
|
2 |
p_age = other.p_age; |
71 |
|
2 |
p_name = other.p_name; |
72 |
|
2 |
} |
73 |
|
|
|
74 |
|
|
///Initialisation function of the class Shadok |
75 |
|
7 |
void Shadok::initialisationShadok(){ |
76 |
|
7 |
p_age = 0; |
77 |
|
7 |
p_name = ""; |
78 |
|
7 |
} |
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|