2.3. Third Exercise Create a Point class (or change the corrected version from Exercise 01) with two private properties representing x and y coordinates, each of which defaults to the constants originx and originY, which are both initialised to 0. Provide three overloaded constructors: the first one sets the coordinates to their default values; the second gets the coordinates x and y as parameters; and the third receives an object of type Point and transfers its coordinates to the current (this) Point object. Provide a function toString() { [native code] } function that returns a String containing the point coordinates; an example of the delivered result is as follows: (5.1.3, 2.3) Create a PointTest class to put the various constructors and function toString() { [native code] } function to the test.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 8SA: Consider the definition of the following class: (1, 2, 3, 5, 7) a. Give the line number...
icon
Related questions
Question
2.3. Third Exercise
Create a Point class (or change the corrected version from Exercise 01) with two private properties representing x and y coordinates, each of which defaults to the constants originx and originY, which are both initialised to 0.
Provide three overloaded constructors: the first one sets the coordinates to their default values; the second gets the coordinates x and y as parameters; and the third receives an object of type Point and transfers its coordinates to the current (this) Point object.
Provide a function toString() { [native code] } function that returns a String containing the point coordinates; an example of the delivered result is as follows:
(5.1.3, 2.3)
Create a PointTest class to put the various constructors and function toString() { [native code] } function to the test.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning