-
Notifications
You must be signed in to change notification settings - Fork 0
/
composition.cpp
87 lines (79 loc) · 1.63 KB
/
composition.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
using namespace std;
class driver
{
protected:
string driver_name;
bool lisenced;
public:
driver() {}
driver(string driver_name, bool lisenced)
{
this->driver_name = driver_name;
this->lisenced = lisenced;
}
void setdriver(string driver_name, bool lisenced)
{
this->driver_name = driver_name;
this->lisenced = lisenced;
}
string getdrivername()
{
return driver_name;
}
bool getdriverlisenced()
{
return lisenced;
}
};
class car
{
protected:
string car_name;
string car_no_plate;
driver d1;
public:
car()
{
car_name = "WOLKSWAGON";
car_no_plate = "ABC-123";
}
car(string car_name, string car_no_plate)
{
this->car_name = car_name;
this->car_no_plate = car_no_plate;
}
car(const car &obj)
{
this->car_name = obj.car_name;
this->car_no_plate = obj.car_no_plate;
}
void setcar(string car_name, string car_no_plate)
{
this->car_name = car_name;
this->car_no_plate = car_no_plate;
}
void setdriver2(string driver_name, bool lisenced)
{
d1.setdriver(driver_name, lisenced);
}
string getcarname()
{
return car_name;
}
string getcarnoplate()
{
return car_no_plate;
}
string getdrivername2(){
return d1.getdrivername();
}
};
int main(){
{
car c1;
c1.setdriver2("ahmed",false);
cout<<c1.getdrivername2();
}
// cout<<c1.getdrivername2();
}