-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.cpp
47 lines (34 loc) · 769 Bytes
/
Model.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
#include "Model.h"
using namespace std;
const string Model::RESOURCE = "none";
Model::Model()
:id(-1) {}
Model::Model(int id)
:id(id) {}
Model::Model(const Model &model)
:id(model.id) {}
Model::~Model() {
cout << "Destroying " << *this << endl;
}
// Operators
ostream &operator<<(ostream &out, const Model &model) {
out << "Model(" << model.id << ")";
return out;
}
const Model &Model::operator=(const Model &right) {
this->id = right.id;
return *this;
}
bool Model::operator==(const Model &right) const {
return (this->id == right.id) && (this->id != -1);
}
bool Model::operator!=(const Model &right) const {
return !(*this == right);
}
// Public
int Model::getId() {
return this->id;
}
const string Model::resource() {
return Model::RESOURCE;
}