-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovie.cpp
More file actions
57 lines (47 loc) · 1.04 KB
/
Copy pathmovie.cpp
File metadata and controls
57 lines (47 loc) · 1.04 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
#include <iostream>
#include <cstring>
#include "classesParent.h"
#include "movie.h"
using namespace std;
// cpp file for movies
Movie::Movie() //default constructor
{
director = new char[100];
duration = 0.0;
rating = 0.0;
}
// constructor with fields
Movie::Movie(char* newtitle, int newyear, char* newdirector, float newduration, float newrating): Parent(newtitle, newyear)
{
director = new char[100];
strcpy(director, newdirector);
duration = newduration;
rating = newrating;
}
// destructor
Movie::~Movie()
{
delete director;
}
char* Movie::getDirector() // returns director
{
return director;
}
float Movie::getDuration() // returns duration
{
return duration;
}
float Movie::getRating() // returns rating
{
return rating;
}
void Movie::print() // prints info
{
cout << "Type: Movie" << endl;
cout << "Title: " << title << endl;
cout << "Year: " << year << endl;
cout << "Director: " << director << endl;
cout << "Duration (minutes): " << duration << endl;
cout << "Rating: " << rating << endl;
cout << "" << endl;
}