-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7101be1
commit d8bc46f
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
OBJECT ORIENTED PROGRAMMING BY CODEBEAUTY/Encapsulation/Inheretence/inheretence.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
class YouTubeChannel | ||
{ | ||
private: | ||
string name; | ||
string OwnerName; | ||
int SubscribersCount; | ||
list<string> PublishedVidioTitles; | ||
|
||
public: | ||
YouTubeChannel(string Name, string Owner) | ||
{ | ||
name = Name; | ||
OwnerName = Owner; | ||
SubscribersCount = 0; | ||
} | ||
|
||
void subscribersCount() | ||
{ | ||
SubscribersCount++; | ||
} | ||
void unsubscribersing() | ||
{ | ||
if (SubscribersCount > 0) | ||
{ | ||
SubscribersCount--; | ||
} | ||
} | ||
|
||
void publishedVidioTitale(string title) | ||
{ | ||
PublishedVidioTitles.push_back(title); | ||
} | ||
|
||
void getInfo() | ||
{ | ||
cout << "Name: " << name << endl; | ||
cout << "Owner Name: " << OwnerName << endl; | ||
cout << "Subscribers Count: " << SubscribersCount << endl; | ||
for (auto it : PublishedVidioTitles) | ||
{ | ||
cout << it << endl; | ||
} | ||
} | ||
}; | ||
|
||
class CockingYouTubeChannel : public YouTubeChannel | ||
{ | ||
public: | ||
CockingYouTubeChannel(string N, string o) : YouTubeChannel(N, o){ | ||
|
||
}; | ||
}; | ||
|
||
int main() | ||
{ | ||
YouTubeChannel myChannel("Space", "Sandeep"); | ||
myChannel.subscribersCount(); | ||
myChannel.subscribersCount(); | ||
myChannel.unsubscribersing(); | ||
myChannel.publishedVidioTitale("Hartless"); | ||
myChannel.getInfo(); | ||
CockingYouTubeChannel coockingChannel("Amiy's Cocking channel", "Amiy"); | ||
coockingChannel.getInfo(); | ||
|
||
// myChannel.name = "CodeBeauty"; | ||
// myChannel.OwnerName = "Salena"; | ||
// myChannel.SubscribersCount = 1800; | ||
// myChannel.PublishedVidioTitles = {"C++ for beggginer vedio 1", "HTML & CSS Video 1", "c++ OOP video 1"}; | ||
|
||
// cout << "Name=" << myChannel.name << endl; | ||
// cout << "Owner Name=" << myChannel.OwnerName << endl; | ||
// cout << "Subscriber Count=" << myChannel.SubscribersCount << endl; | ||
// for (string it: myChannel.PublishedVidioTitles){ | ||
// cout << it << endl; | ||
// } | ||
} |