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
Get step-by-step solutions from verified subject matter experts
