-
Notifications
You must be signed in to change notification settings - Fork 0
/
boisson.cpp
75 lines (59 loc) · 1.49 KB
/
boisson.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "boisson.h"
boisson::boisson(){}
boisson::boisson(string _nom, int _avis, int _prix, const QString _imagePath):
plat(_nom, {}, _avis, 0,_prix, _imagePath){}
float boisson::getAlcool_degre() const
{
return alcool_degre;
}
void boisson::setAlcool_degre(float value)
{
if (value >= 0)
alcool_degre = value;
else
ERROR_BAD_VALUE(alcool_degre, value);
}
vector<int> boisson::getTaille() const
{
return taille;
}
void boisson::setTaille(vector<int> value)
{
taille = value;
}
bool boisson::isAlcool()
{
return (alcool_degre > 0);
}
// Surcharge des fonctions de traitement des attributs non utilisés pour renvoyer une erreur
int boisson::getCalorie() const
{
ERROR_NO_ATTRIB(calorie, boisson);
return -1;
}
void boisson::setCalorie(int value)
{
UNUSED(value);
ERROR_NO_ATTRIB(calorie, boisson);
}
vector<string> boisson::getIngredient() const
{
ERROR_NO_ATTRIB(ingredient, boisson);
return {};
}
void boisson::setIngredient(const vector<string> &value)
{
UNUSED(value);
ERROR_NO_ATTRIB(ingredient, boisson);
}
void boisson::printAttrib()
{
cout << "Print " << nom << endl << " Taille:" << endl;
for(vector<int>::iterator it = taille.begin(); it != taille.end(); ++it){
cout << " " << *it << endl;
}
cout << " avis " << avis << endl
<< " alcool " << alcool_degre << endl
<< " prix " << prix << endl
<< " description " << description <<endl;
}