-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovie.cpp
More file actions
57 lines (50 loc) · 1.25 KB
/
Copy pathMovie.cpp
File metadata and controls
57 lines (50 loc) · 1.25 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
56
57
/*
* Streaming Service Modeling Proyect
* Rommel T.
*/
/*
* Definition of Movie class
*/
#include "Movie.h"
/**
* Constructor for the Movie class.
* @param string id_: the ID of the movie
* string name_: the name of the movie
* int length_: the length of the movie
* string genres_: the genres of the movie
* int rating_: the rating of the movie
* @return Movie object
*/
Movie::Movie(string id_, string name_, int length_, string genres_, int rating_):Video("M" + id_, name_, length_, genres_, rating_){
setId(id_);
setName(name_);
setLength(length_);
setGenre(genres_);
setRating(rating_);
}
/**
* Sets the ID of the movie.
* @param string id: the ID of the movie
* @return
*/
void Movie::setId(string id){
this->id = "M" + id;
}
/**
* Overloads the + operator to add time to the movie's length.
* @param int timeToAdd: the time to add to the movie's length
* @return
*/
void Movie::operator+(int timeToAdd){
this->length += timeToAdd;
}
/**
* Overloads the - operator to reduce time from the movie's length.
* @param int timeToReduce: the time to reduce from the movie's length
* @return
*/
void Movie::operator-(int timeToReduce){
if((this->length - timeToReduce) > 0){
this->length -= timeToReduce;
}
}