-
Notifications
You must be signed in to change notification settings - Fork 0
/
BridgePattern_Sol3.py
85 lines (62 loc) · 1.74 KB
/
BridgePattern_Sol3.py
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
class shape():
types = ""
def __init__(self, types=None):
self.types = types
def draw(self):
pass
def drawline(self):
pass
def drawcircle(self):
pass
class circle(shape):
def __init__(self, types=None):
super().__init__()
self.types = types
def draw(self):
print("Drawing the Circle...!")
class rectangle(shape):
def __init__(self, types=None):
super().__init__()
self.types = types
def draw(self):
print("Drawing the Rectangle...!")
class drawing(shape):
def __init__(self, types=None):
super().__init__()
self.types = types
def drawline(self):
print("This is rectangle diagram")
def drawcircle(self):
print("This is circle diagram")
class v1drawing(drawing):
def __init__(self,):
super().__init__()
self.types = "method1"
def drawline(self):
print("Method 1 drawing rectangle")
def drawcircle(self):
print("Method 1 drawing circle")
class v2drawing(drawing):
def __init__(self,):
super().__init__()
self.types = "method2"
def drawline(self):
print("Method 2 drawing rectangle")
def drawcircle(self):
print("Method 2 drawing circle")
class DP1(v1drawing):
def __init__(self):
super().__init__()
self.drawline()
self.drawcircle()
class DP2(v2drawing):
def __init__(self):
super().__init__()
self.drawline()
self.drawcircle()
if __name__ == '__main__':
DP = str(input("What design pattern is requested: "))
if DP == 'DP1':
DP1()
else:
DP2()