-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.cpp
46 lines (37 loc) · 987 Bytes
/
Student.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
/*
Name: Eric Rabiner
Email: [email protected]
Date: July 6, 2019
*/
#include "Student.h"
namespace sict {
Student::Student(const std::string& str) {
size_t pos = 0;
id = std::stoi(_utility.extractToken(str, pos));
name = _utility.extractToken(str, pos);
}
const unsigned int Student::getId() const {
return id;
}
const std::string& Student::getName() const {
return name;
}
void Student::display(std::ostream& os) const {
os << "Student ID: " << getId() << ", name: " << getName() << std::endl;
}
Student::Student(Student&& src) {
*this = std::move(src);
}
Student& Student::operator=(Student&& src) {
if (this != &src) {
id = src.id ;
name = src.name;
src.id = 0;
src.name = "";
}
}
std::ostream& operator<<(std::ostream& os, const Student& obj) {
obj.display(os);
return os;
}
}