-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrama.cpp
48 lines (40 loc) · 979 Bytes
/
Drama.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
#include "Drama.h"
// constructor
Drama::Drama()
{
}
// destructor
Drama::~Drama()
{
}
// getter for Genre
string Drama::getGenre()
{
return GENRE;
}
// sets Data from transaction file
void Drama::setTData(ifstream& File)
{
Movie::setDT(File);
}
// returns true if Rhs is equal to this
bool Drama::operator==(const Movie& Rhs) const
{
const auto D = dynamic_cast<const Drama&>(Rhs);
return (GENRE == D.GENRE && Director == D.Director && Title == D.Title);
}
// returns true if Rhs is less than this
// compares Director first, then Title
bool Drama::operator<(const Movie& Rhs) const
{
const auto D = dynamic_cast<const Drama&>(Rhs);
if (Director < D.Director) return true;
return (Director == D.Director && Title < D.Title);
}
// returns string containing sorting attributes (Director then Title)
string Drama::tDisplay() const
{
string Ret;
Ret += GENRE + " " + Director + ", " + Title;
return Ret;
}