Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Car {
- public:
- string name;
- string engine;
- string gearbox;
- int wheels;
- int year;
- bool working = false;
- Car(string n, string e, string gb, int wh, int y) {
- name = n;
- engine = e;
- gearbox = gb;
- wheels = wh;
- year = y;
- }
- ~Car(){};
- void start_engine() {
- working = true;
- }
- void stop_engine() {
- working = false;
- }
- };
- int main()
- {
- Car renault("Renault Logan", "1.4", "Auto", 4, 2015);
- Car volvo("volvo s60", "2.0", "Robot", 4, 2004);
- renault.start_engine();
- cout << renault.working << endl;
- cout << volvo.working;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement