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