30. Sum of Two Objects

 Create two classes: Point and Distance.

  • Both classes store a private integer.
  • Define a friend function named sumValues(const Point&, const Distance&).
     

This function should add the private integers from both objects and print the result in the format:

 Sum=<value>

 

In main():

  • Read two integers (first for Point, second for Distance).
  • Create objects of both classes.
  • Call sumValues() to print the sum.
     

Example
 Input:

5 7

Output:

Sum=12

 

Input:

10 20

Output:

Sum=30
Loading...

Input

5 7

Expected Output

Sum=12