class point public: // CONSTRUCTOR point (double initial-x = 0.0, double initial
ID: 3878863 • Letter: C
Question
class point public: // CONSTRUCTOR point (double initial-x = 0.0, double initial-y = 0.0); // MODIFICATION MEMBER FUNCTIONS /I CONSTANT MEMBER FUNCTIONS point operatort (double ∈) const friend point operatort (double &lhs;, point& rhs); private: double x; // x coordinate of this point double y; // y coordinate of this point 1i Which line is invalid? Explain why. 1. point myPointl, myPoint2; 2. double shift = 8.5; 3. myPoint1 = shift + myPoint2; 4. myPointl.operator+(shift); 5. myPointl - myPointl + shift; How would you fix the problem?Explanation / Answer
data type of shift is double. THis is the invalid part. Line 3,4,5 would show error.
TO fix this make shift of class point with initiatlising pointShift.x as 8.5
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.