CJCoding With Joseph
15free / daySign inCreate account

Distance Subtract (operator-)

You are tracking distance along a running route.

Create a class Distance that stores meters as an int.

Requirements:
1) Constructor Distance(int meters)
2) int getMeters() const
3) Overload operator- to subtract two Distance values and return a NEW Distance

Do NOT write a main function.

Expected Output:

250
-10

= 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.