-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordPair.cpp
More file actions
55 lines (43 loc) · 1.06 KB
/
WordPair.cpp
File metadata and controls
55 lines (43 loc) · 1.06 KB
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
54
55
/*
* WordPair.cpp
*
* Description: Models an English word and its translation in another language.
*
* Author: AL
* Date of last modification: July 2017
*/
#include "WordPair.h"
// Constructors
WordPair::WordPair() {
english = "";
translation = "";
}
WordPair::WordPair(string english) {
this->english = english;
this->translation = "";
}
WordPair::WordPair(string english, string translation) {
this->english = english;
this->translation = translation;
}
// Getters
string WordPair::getEnglish() const {
return this->english;
}
string WordPair::getTranslation() const {
return this->translation;
}
// Setters
void WordPair::setEnglish(string english) {
this->english = english;
}
void WordPair::setTranslation(string translation) {
this->translation = translation;
}
// Overloaded Operators
bool WordPair::operator==(const WordPair& rhs) const {
return (this->english.compare(rhs.getEnglish()) ) == 0;
} // end of operator==
bool WordPair::operator<(const WordPair& rhs) const {
return (this->english.compare(rhs.getEnglish()) ) < 0;
} // end of operator<