← Back to Classes
Question 66
Score Prefix Increment (operator++)
Score Prefix Increment (operator++)
You are tracking points in a game.
Create a class Score with a private int points.
Requirements:
1) Constructor Score(int p)
2) int getPoints() const
3) Overload PREFIX operator++ to add 1 point and return *this
Do NOT write a main function.Expected Output:
11 0
= newline. The output ends with a newline — print one after the last line.
Hints3 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.