Question: Overload the following operators as class methods. 1. operator= (const PointInt &rhs), method of class PointDbl, returns reference PointDbl&. 2. operator= (const PointDbl &rhs), method

Overload the following operators as class methods. 1. operator= (const PointInt &rhs), method of class PointDbl, returns reference PointDbl&. 2. operator= (const PointDbl &rhs), method of class PointInt, returns reference PointInt&.
Explain if a check for self-assignment is necessary. If yes, write the self-assignment test in your code. If no, explain why not.
Note: the assignment PointInt = PointDbl will result in loss of decimal places. Write (x in PointInt) = (x in PointDbl), etc. (analogous to j = y on the previous page).
Overload two versions of operator+, both as external functions. 1. operator+ binary operator with inputs (PointDbl, PointInt), returns PointDbl. 2. operator+ binary operator with inputs (PointInt, PointDbl), returns PointDbl.
code should support the following operations. // assignment PointDbl = PointInt // assignment PointInt = PointDbl // loss of decimal places // addition PointDbl = PointDbl + PointInt // addition PointDbl = PointInt + PointDbl
Write the output printed by the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
