-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComedy.cpp
56 lines (48 loc) · 1.1 KB
/
Comedy.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
54
55
56
#include "Comedy.h"
// constructor
Comedy::Comedy()
{
}
Comedy::Comedy(int S, const string& D, const string& T, int Y)
{
Stock = S;
InitialStock = S;
Director = D;
Title = T;
Year = Y;
}
// destructor
Comedy::~Comedy()
{
}
string Comedy::getGenre()
{
return GENRE;
}
// sets data from transaction file
void Comedy::setTData(ifstream& File)
{
Movie::setT(File);
File >> Year;
}
// returns true if Rhs' sorting attributes are equal to this
bool Comedy::operator==(const Movie& Rhs) const
{
const auto F = dynamic_cast<const Comedy&>(Rhs);
return (GENRE == F.GENRE && Title == F.Title && Year == F.Year);
}
// returns true if Rhs' sorting attribtues are less than this
bool Comedy::operator<(const Movie& Rhs) const
{
const auto F = dynamic_cast<const Comedy&>(Rhs);
if (Title < F.Title) return true;
if (Title == F.Title && Year < F.Year) return true;
return false;
}
// returns string containing sorting attributes
string Comedy::tDisplay() const
{
string Ret;
Ret += GENRE + " " + Title + ", " + std::to_string(Year);
return Ret;
}