-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassics.h
66 lines (50 loc) · 1.58 KB
/
classics.h
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
57
58
59
60
61
62
63
64
65
66
/**
* Classic.h
* Child class of Movies, a Classics is a specific type of Movie
* that unlike all movies a Classics movie has Major Actor and Release Date
* Classics (‘C’) are sorted by Release date, then Major actor
*
* @authorOlga Kuriatnyk
*/
#ifndef CLASSIC_H
#define CLASSIC_H
#include <ostream>
#include "movie.h"
class Classics : public Movie {
public:
// Constructor
explicit Classics(const char &movieType);
// Default destructor
~Classics() override;
// copy constructor not allowed
Classics(const Classics &c) = delete;
// move not allowed
Classics(Classics &&other) = delete;
// assignment not allowed
Classics &operator=(const Classics &other) = delete;
// move assignment not allowed
Classics &operator=(Classics &&other) = delete;
// reads the line from the file and sets the values to this object
// has validation check for stock, year and month
bool read(istream &is) override;
// overload for printing out movie
void printMovie() const override;
private:
string majorActor;
string releaseDate;
// @return true if the month is from 1 to 12
bool isMonthValid(const int &month) const;
};
// Creating ClassicFactory to make Classic objects
// ClassicFactory object will register itself later and get stored in the Item
// class
class ClassicsFactory : public MovieFactory {
public:
// when called will register Classic in the Item class
ClassicsFactory() { Movie::registerType('C', this); }
// @return new Item object
Movie *create(const char &movieType) const override {
return new Classics(movieType);
};
};
#endif