damn thank u and i have another question tell me in return distance does it return d3 value and operator needs one argument does it pass d2 or d1 as argument and shouldnt it take 2 arguments like how it is implemented in function
in line 28 of the code arguments of the operator are (Distance temp) when operator function was called which object was passed for the function was it object d1 or d2 another thing doesnt it need two argument for the addition of two objects
No, you can see that the function accesses the "feet" and "inches" member variables directly.
This is because when you overload an operator as a class member, the current object on which the operator is invoked is used as its left hand argument, to clarify:
1 2 3
Distance A, B, C;
C = A+B;
You could also write this as: A.operator+(B)[.
So B will be "temp" and the member variables of A will be accessed directly in the function.