014-002-003
Copy Constructor: Coordinate Class
Easy
Problem Description
Copy constructor: Coordinate class
In this problem, you will create a program that implements a copy constructor in the Point class to duplicate an existing object into a new one, then displays the coordinates of both the original and copied objects to standard output.
Learning Objective: Understand how to clone objects using copy constructor
Implement a copy constructor in Point class to create a new object from an existing one.
Input
Line 1: x coordinate (integer)
Line 2: y coordinate (integer)
Output
Original: ([x], [y])
Copy: ([x], [y])
Same object: false
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up