I was just wondering how I would compare 2 different object member of the same class. I want to compare the int speed between the 2 objects.
Lets say I have a
class Car
{
private:
int speed;
public:
int compare(Car car)
}
main()
{
Car Honda, Toyota;
//Lets say I have declared Honda.speed = 5 Toyota.speed = 10
Honda.Compare(Toyota);
}
int Car::compare(Car car)
{
if(this->speed > //What do i put here to compare the speed? )
cout << "this car is faster";
if(this->speed < //???? )
cout << "this car is slower";
}