-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem.cpp
More file actions
28 lines (22 loc) · 758 Bytes
/
Item.cpp
File metadata and controls
28 lines (22 loc) · 758 Bytes
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
#include "Item.h"
Item::Item() : Object("UNKNOWN", "Item") {}
Item::Item(string name, string tag) : Object(name, tag) {}
bool Item::operator<(const Item &item) const {
return this->getName() < item.getName();
}
void Item::saveFile(ofstream &os) {
Object base = *this;
base.saveFile(os);
}
void Item::loadFile(ifstream &os) {
Object *base = new Object();
base->loadFile(os);
this->setName(base->getName());
this->setTag(base->getTag());
}
void Item::Show_Status(ostream &os) const {
os << Color::Blue << "=======Item=======" << Color::Default << '\n'
<< "Name: " << Color::Yellow << Item::getName() << '\n' << Color::Default
<< Color::Blue << "==================" << Color::Default << '\n'
<< endl;
}