| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include <iostream>
- #include <list>
- #include <string>
- class YoutubeChannel
- {
- private:
- std::string name;
- int subscribersCount;
- std::list<std::string> videoList;
- protected:
- std::string ownerName;
- int contentQuality=0;
- public:
- YoutubeChannel(std::string _name, std::string _owner)
- {
- name = _name;
- ownerName = _owner;
- subscribersCount = 0;
- }
- void subscribe()
- {
- subscribersCount++;
- }
- void unsubscribe()
- {
- if (subscribersCount > 0)
- subscribersCount--;
- else
- {
- std::cout << "Can't unsubscribe this channel" << std::endl;
- }
- }
- void pub_video(std::string v)
- {
- videoList.push_back(v);
- }
- void qualityCheck()
- {
- std::cout<<contentQuality<<std::endl;
- if(contentQuality<5)
- {
- std::cout<<"The quality of "<<name<<" channel is bad."<<std::endl;
- }
- else
- {
- std::cout<< name << " has great quality!"<<std::endl;
- }
- }
- void show_info()
- {
- std::cout << "**************************" << std::endl;
- std::cout << "Name: " << name << std::endl;
- std::cout << "Owner: " << ownerName << std::endl;
- std::cout << "Subscribers: " << subscribersCount << std::endl;
- std::cout << "Videos:" << std::endl;
- for (std::string _value : videoList)
- {
- std::cout << "\t" << _value << std::endl;
- }
- std::cout << "**************************" << std::endl;
- }
- };
- class CookingYoutubeChannel : public YoutubeChannel
- {
- public:
- CookingYoutubeChannel(std::string name, std::string ownerName) : YoutubeChannel(name, ownerName) {}
- void practice()
- {
- std::cout << ownerName << " is practicing cooking..." << std::endl;
- std::cout << ownerName << "'s channel has gained 1 content quality point." << std::endl;
- contentQuality++;
- }
- };
- class SingingYoutubeChannel : public YoutubeChannel
- {
- public:
- SingingYoutubeChannel(std::string name, std::string ownerName) : YoutubeChannel(name, ownerName) {}
- void practice()
- {
- std::cout << ownerName <<" is practicing cooking..." << std::endl;
- std::cout << ownerName << "'s channel has gained 1 content quality point." << std::endl;
- contentQuality++;
- }
- };
|