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