CJCoding With Joseph
15free / daySign inCreate account

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

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
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.