-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.cpp
More file actions
55 lines (52 loc) · 1.07 KB
/
Copy pathitem.cpp
File metadata and controls
55 lines (52 loc) · 1.07 KB
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
#include "item.h"
using namespace std;
Item::Item(string _name, float _price,int _type) {
name = _name;
price = _price;
type = static_cast<Item_type>(_type);
next = nullptr;
}
Item::Item(string _name, float _price,int _type, Item *next) {
name = _name;
price = _price;
type = static_cast<Item_type>(_type);
this->next = next;
}
void Item::set_next (Item *next) {
this->next = next;
}
float Item::get_price() {
return price;
}
Item_type Item::get_type() {
return type;
}
string Item::get_name() {
return name;
}
Item* Item::get_next () {
return next;
}
void Item::display() {
cout << name << " , " << price << " , ";
switch (type) {
case food:
cout << "Food";
break;
case drink:
cout << "Drink";
break;
case dessert:
cout << "Dessert";
break;
default :
break;
}
cout << endl;
}
void Item::copy(Item other) {
name = other.name;
price = other.price;
type = other.type;
next = other.next;
}