Overload operator for Car class

I need to overload this operator for my class Car..

It should compare each attribute for the object, and cout the things which are the same.

ex.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Clas car {
Public:
Car(int,int,int,int);
Int Engine;
Int maxSpeed;
int HorsePower;
};

car::car(int a, int b, int c)
{
engine = a;
maxSpeed = b;
Horsepower = c;


// in my main I would have ..

car Opel (2,2,2);
car Ferrari (99,99,2);
// and by doing opel == ferarri => it should say which car has the better engine,maxspeed,horsepower..

}


I am a bit lost on how to overload operator, and it would help me alot, if someone could tell how to do it.. I understand the concept of using and why it used, but how someone would do, that ....
Topic archived. No new replies allowed.