Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<string>
- #include<iostream>
- using namespace std;
- class Car
- {
- string make, model;
- int year;
- double price;
- //The lines above, since they are not declared to be public or private, are declared private by default
- public:
- Car();
- void print();
- bool operator == (Car car);
- friend void set_data(Car &c);
- };
- Car::Car()
- {
- this->make = "";
- this->model = "";
- this->price = 0.0;
- this->year = 0;
- }
- void Car::print()
- {
- cout << "Make: " << this->make << endl;
- cout << "Model: " << this->model << endl;
- cout << "Price: " << this->price << endl;
- cout << "Year: " << this->year << endl;
- return;
- }
- bool Car::operator == (Car car)
- {
- return this->make == car.make;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement