-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
34 lines (24 loc) · 655 Bytes
/
test.py
File metadata and controls
34 lines (24 loc) · 655 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
class Car:
def __init__(self, model, color):
self.model = model
self.color = color
def printDetails(self):
print("Model:", self.model)
print("Color:", self.color)
class SedanEngine:
def start(self):
print("Car has started.")
def stop(self):
print("Car has stopped.")
class Sedan(Car):
def __init__(self, model, color):
super().__init__(model, color)
self.engine = SedanEngine()
def setStart(self):
self.engine.start()
def setStop(self):
self.engine.stop()
car1 = Sedan("Toyota", "Grey")
car1.setStart()
car1.printDetails()
car1.setStop()