Playlist Track Access (const and non-const operator[])
mediumQuestion 79You are managing a tiny playlist of 3 song titles.
Create a class Playlist with a private array of 3 strings.
Requirements:
1) Constructor Playlist(string a, string b, string c)
2) Overload operator[] in TWO ways:
- string& operator[](int index) (non-const)
- const string& operator[](int index) const
Do NOT write a main function.
Expected output
Focus Deep Work
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
ClassesOperator Overloading
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.