comparing values in objects

Hi Everybody
I have learned how to call member functions.But what I could not understand is this .
I have a member function that compares the sum of 2 values in an object to the sum of the sum of two values in another object of the same class.
Like this


the question symbolically is
obj1(x+y)<=obj2(x+y) ...................
I could not add them and compare with the others
Last edited on
You could say:

obj1.x + obj1.y <= obj2.x + obj2.y

if the data members are public. If they are private (and they should be), you can write getX() and getY() methods to retrieve those values.
Last edited on
Topic archived. No new replies allowed.