File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 5
5
6
6
7
7
class SalesManager :
8
-
9
8
def work (self ):
10
9
print ("Sales Manager working..." )
11
10
@@ -14,7 +13,6 @@ def talk(self):
14
13
15
14
16
15
class Proxy :
17
-
18
16
def __init__ (self ):
19
17
self .busy = 'No'
20
18
self .sales = None
@@ -30,14 +28,32 @@ def work(self):
30
28
print ("Sales Manager is busy" )
31
29
32
30
31
+ class NoTalkProxy (Proxy ):
32
+ def __init__ (self ):
33
+ Proxy .__init__ (self )
34
+
35
+ def work (self ):
36
+ print ("Proxy checking for Sales Manager availability" )
37
+ time .sleep (2 )
38
+ print ("This Sales Manager will not talk to you whether he/she is busy or not" )
39
+
40
+
33
41
if __name__ == '__main__' :
34
42
p = Proxy ()
35
43
p .work ()
36
44
p .busy = 'Yes'
37
45
p .work ()
46
+ p = NoTalkProxy ()
47
+ p .work ()
48
+ p .busy = 'Yse'
49
+ p .work ()
38
50
39
51
### OUTPUT ###
40
52
# Proxy checking for Sales Manager availability
41
53
# Sales Manager ready to talk
42
54
# Proxy checking for Sales Manager availability
43
55
# Sales Manager is busy
56
+ # Proxy checking for Sales Manager availability
57
+ # This Sales Manager will not talk to you whether he/she is busy or not
58
+ # Proxy checking for Sales Manager availability
59
+ # This Sales Manager will not talk to you whether he/she is busy or not
You can’t perform that action at this time.
0 commit comments