CJCoding With Joseph
15per day

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