-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMark.cpp
52 lines (43 loc) · 1.21 KB
/
Mark.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
/*
Name: Eric Rabiner
Email: [email protected]
Date: July 6, 2019
*/
#include "Mark.h"
namespace sict {
Mark::Mark(const std::string& str) {
size_t pos = 0;
testId = std::stoi(_utility.extractToken(str, pos));
studentId = std::stoi(_utility.extractToken(str, pos));
mark = std::stoi(_utility.extractToken(str, pos));
}
const unsigned int Mark::getTestId() const {
return testId;
}
const unsigned int Mark::getStudentId() const {
return studentId;
}
const unsigned int Mark::getMark() const {
return mark;
}
void Mark::display(std::ostream& os) const {
os << "Test Id: " << getTestId() << ", studentId: " << getStudentId() << ", Mark: " << getMark() << std::endl;
}
Mark::Mark(Mark&& src) {
*this = std::move(src);
}
Mark& Mark::operator=(Mark&& src) {
if (this != &src) {
testId = src.testId;
studentId = src.studentId;
mark = src.mark;
src.testId = 0;
src.studentId = 0;
src.mark = 0;
}
}
std::ostream& operator<<(std::ostream& os, const Mark& obj) {
obj.display(os);
return os;
}
}