-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut53.cpp
More file actions
66 lines (61 loc) · 1.59 KB
/
tut53.cpp
File metadata and controls
66 lines (61 loc) · 1.59 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
58
59
60
61
62
63
64
65
66
#include<iostream>
#include<cstring>
using namespace std;
class cwh{
protected:
string title;
float rating;
public:
cwh(string s, float r){
title = s;
rating = r;
}
virtual void display(){};
};
class cwhvid:public cwh{
int vidlength;
public:
cwhvid(char *s, float r, int vl ):cwh(s, r){
vidlength = vl;
}
void display(){
cout<<"This is an amazing video with title"<<title<<endl;
cout<<"The rating out of 5 is "<<rating<<endl;
cout<<"The lenth of video is "<<vidlength<<" minutes"<<endl;
}
};
class cwhtext:public cwh{
int words;
public:
cwhtext(string s, float r, int wc ):cwh(s, r){
words = wc;
}
void display(){
cout<<"This is an amazing video with title"<<title<<endl;
cout<<"The rating out of 5 is "<<rating<<endl;
cout<<"The lenth of video is "<<words<<" minutes"<<endl;
}
};
int main(){
string title;
float rating, vlen;
int words;
//Next CWH video tutorial JavaScript
title = "JS vid tutorial";
vlen = 4.56;
rating = 4.89;
cwhvid jsvid(title, rating, vlen);
jsvid.display();
return 0;
//Next CWH text tutorial JavaScript
title = "JS text tutorial";
words = 433;
rating = 4;
cwhtext jstext(title, rating, words);
jstext.display();
cwh *tuts[2];
tuts[0] = &jsvid;
tuts[1] = &jstext;
tuts[0]->display();
tuts[1]->display();
}