Example:13
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 “+” with friend function.
code
Output:
Example:14
Declare a class named “distance” with attributes as km, m and cm. Take input for two objects calculate and print their sum using overloaded binary operator “+”.
code
Output:
Example:15
Declare a class named “distance” with attributes as km, m and cm. Take input for two objects calculate and print their sum using overloaded binary operator “+” with friend function.
code
Output: