-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovie.h
52 lines (40 loc) · 1.65 KB
/
Movie.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
/******************************************************************
* Movie.h
*
* Models a Movie with the following atttributes
*
* std::string name - the name of the movie
* std::string rating - G, PG, PG-13, R
* int watched - the number of times you've watched the movie
* ***************************************************************/
//include guard has been used to avoid the problem of double inclusion when dealing with the include directive
#ifndef _MOVIE_H_
#define _MOVIE_H_
#include <string>
class Movie
{
private:
std::string name; // the name of the movie
std::string rating; // the movie rating G,PG, PG-13, R
int watched; // the number of times you've watched the movie
public:
// Constructor - expects all 3 movie attributes
Movie(std::string name, std::string rating, int watched);
// Copy constructor
Movie(const Movie &source);
// Destructor
~Movie();
// Basic getters and setters for private attributes
// implement these inline and watch your const-correctness
void set_name(std::string name) {this->name = name; }
std::string get_name() const { return name; }
void set_rating(std::string rating) {this->rating = rating; }
std::string get_rating() const { return rating; }
void set_watched(int watched) {this->watched = watched; }
int get_watched() const { return watched; }
// Simply increment the watched attribute by 1
void increment_watched() { ++watched; }
// simply displays the movie information ex.) Big, PG-13, 2
void display() const;
};
#endif // _MOVIE_H_