-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractise2.cpp
More file actions
51 lines (41 loc) · 923 Bytes
/
Copy pathpractise2.cpp
File metadata and controls
51 lines (41 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
using namespace std;
class Vehicle {
public:
int wheels;
int doors;
int engineCylinders;
void isEngineRunning(){
cout << "Vehicle engine is running" << endl;
}
};
class Car: public Vehicle{
public:
Car(int w, int d, int c){
this->wheels = w;
this->doors = d;
this->engineCylinders = c;
}
};
class PickUp: public Vehicle {
public:
PickUp (int wheelCount, int doors, int cylinders) {
this->wheels = wheelCount;
this->doors = doors;
this->engineCylinders = cylinders;
}
void getDetails(){
cout << "PickUp has " << wheels << " wheels." << endl;
cout << "PickUp has " << doors << " doors." << endl;
cout << "PickUp is " << engineCylinders << " cylinders engine." << endl;
}
};
int main() {
// Vehicle v1;
// PickUp p1(4, 2, 6);
// p1.getDetails();
Car c1(4, 4, 3);
// c1.getDetails();
c1.isEngineRunning();
return 0;
}