Overload the comparative operator so that it outputs whether a vehicle is the same or not. A vehicle is the same if its data members match.
Additionally overload the greater than/ less than operator so that it outputs whether a vehicle is "older", "newer" or "the same age" (data member value yearOfConstruction).
Use the following program:
#include "iostream"
#include "cstdlib"
using namespace std;
class Vehicle
{
private:
string brand;
string licencePlate;
int hp;
int yearOfConstruction;
public:
void displayData()
{
cout << "Brand: " << brand << endl;
cout << "Licence plate: " << licencePlate << endl;
cout << "Number of HP: " << hp << endl;
cout << "Year of construction: " << yearOfConstruction << endl;
}
};
int main()
{
system("pause");
return 0;
};
\ No newline at end of file
Overload the comparative operator so that it outputs whether a vehicle is the same or not. A vehicle is the same if its data members match.
Additionally overload the greater than/ less than operator so that it outputs whether a vehicle is "older", "newer" or "the same age" (data member value yearOfConstruction).