Question: 5 Given the declaration of a class Point: class Point { public: Point (double=0.0, double=0.0); Point &setValue(double, double); void print() const; private: double x, y;

5 Given the declaration of a class Point: class Point { public: Point (double=0.0, double=0.0); Point &setValue(double, double); void print() const; private: double x, y; }; Write appropriate definition for the constructors and the function setValue and print. You should use the this pointer as the return value in the function setValue so that you can use the statement myObject.setValue(4,5).print(). The output of the function print is (4, 5). In you main function, create an object and call setValue().print().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!