โ Back to Polymorphism
Question 554
ToString Override for Point
ToString Override for Point
Override theToStringmethod on thePointclass so printing a point shows it as(X, Y). BecauseConsole.WriteLinecallsToStringautomatically, your override controls how the object appears. Do NOT write aMainmethod. Fornew Point(3, 4)the program prints: (3, 4)
Expected Output:
(3, 4)
Topics:
Polymorphism
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.