โ Back to Classes
Question 69
WeekSchedule Indexing (operator[])
WeekSchedule Indexing (operator[])
You are storing a simple weekly schedule. Create a class WeekSchedule that stores 7 strings (one for each day). Requirements: 1) Constructor WeekSchedule(const string days[7]) that copies the 7 values 2) Overload operator[] to return the string at an index (0 to 6) Return type should be string (by value) for simplicity. Do NOT write a main function.
Expected Output:
Gym Rest
Topics:
ClassesOperator Overloading
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.