0

Help me...error appeared while trying to run this code

#include <iostream> #include<list> using namespace std; class YouTubeChannel{ private: string Name; string OwnerName; int SubscriberCount; list<string> PublishedVideos; public: YouTubeChannel(string name, string ownerName){ Name = name; OwnerName=ownerName; SubscriberCount=0; } void GetInfo(){ cout<<"Name "<<Name<<endl; cout<<"Owner Name "<<OwnerName<<endl; cout<<"SubscriberCount : "<<SubscriberCount<<endl; } void Subscribe(){ SubscriberCount++; } void Unsubscribe(){ SubscriberCount--; } void PublishedVideos(string title){ PublishedVideos.push_back(title); } }; int main(){ YouTubeChannel ytChannel("The_Science_Factor ", "Mohd_Rahim_Ali"); ytChannel.PublishedVideos("Space Science "); ytChannel.PublishedVideos("Facts"); ytChannel.PublishedVideos("Scientist who killed by their own inventions"); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Subscribe(); ytChannel.Unsubscribe(); ytChannel.Unsubscribe(); ytChannel.Unsubscribe(); ytChannel.GetInfo(); return 0; }

6th May 2021, 6:24 PM
Mohd Rahim Ali
Mohd Rahim Ali - avatar
1 Antwort
0
You are having the same name of function and list Change the name of function to PublishedVideo(String title) And change it every where when it is called
6th May 2021, 6:34 PM
Mohd Maaz Azhar
Mohd Maaz Azhar - avatar