-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday5_YoutubeChannelManagment.cpp
More file actions
102 lines (98 loc) · 2.52 KB
/
day5_YoutubeChannelManagment.cpp
File metadata and controls
102 lines (98 loc) · 2.52 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include<iostream>
#include<list>
using namespace std;
class youTubeChannel{
private:
string Name;
int subCounter=0;
list<string> uploadVideo;
//use protected access specifier because ownerName data meber can use in funnyChannel class
protected:
string ownerName;
int checkContent=0;
public:
youTubeChannel(string name,string owner_name){
Name=name;
ownerName=owner_name;
}
void getData()
{
cout<<"Name:"<<Name<<endl;
cout<<"Owner Name:"<<ownerName<<endl;
cout<<"Subescriber:"<<subCounter<<endl;
cout<<"Uploaded Video:"<<endl;
for(string video:uploadVideo){
cout<<"\""<<video<<"\" ";
}
}
void Subscribe()
{
subCounter++;
}
void Unsubscribe()
{
if(subCounter>0){
subCounter--;
}
}
void publishVideo(string videoName){
uploadVideo.push_back(videoName);
}
void check()
{
if(checkContent<5)
{
cout<<Name<<" has bad content"<<endl;
}else{
cout<<Name<<" has good content"<<endl;
}
}
};
class funnychannel : public youTubeChannel{
public:
funnychannel(string name,string owner_name):youTubeChannel(name,owner_name){
}
void about()
{
cout<<endl<<ownerName<<" uploads video."<<endl;
checkContent++;
}
};
class danceChannel:public youTubeChannel{
public:
danceChannel(string name,string owner_name):youTubeChannel(name,owner_name)
{
}
void about()
{
cout<<endl<<ownerName<<" uploads video."<<endl;
checkContent++;
}
};
int main()
{
//For child class
funnychannel fun("Mahara","Mahesh");
fun.publishVideo("Hirak Raja");
fun.publishVideo("Tui Chaara");
fun.Subscribe();
fun.getData();
fun.about();
fun.about();
fun.about();
fun.about();
fun.about();
fun.about();
youTubeChannel *yt1= &fun;
yt1->check();
cout<<endl<<endl<<endl;
danceChannel dac("Lohalu","Ajay");
dac.publishVideo("Valo basi");
dac.publishVideo("Tera jan");
dac.Subscribe();
dac.getData();
dac.about();
youTubeChannel *yt2= &dac;
yt2->check();
return 0;
}