Example:10
Declare a class named “distance” with attributes as km and m. Take input for two objects calculate and print their sum using overloaded binary operator “+”.
code
Output:
Example:11
Declare a class named “distance” with attributes as km and m. Take input for two objects calculate and print their sum using overloaded binary operator “+” with friend function.
code
Output:
Example:12
Declare a class named “distance” with attributes as m and cm. Take input for two objects calculate and print their sum using overloaded binary operator “+”.
code
Output: