- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
Latest commit
28 lines (19 loc) · 626 Bytes
/
Copy pathproxy.py
File metadata and controls
28 lines (19 loc) · 626 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
classPrinter(object):
defprint(self):
print('printer is now printing')
returnTrue
classPrinterProxy(object):
def__init__(self, user, password):
self.printer=Printer()
self.user=user
self.password=password
defprint(self):
ifself.user!='admin'orself.password!='123456':
print('You have no permission')
returnNone
returnself.printer.print()
if__name__=='__main__':
printer=PrinterProxy('admin', '123456')
printer.print()
printer=PrinterProxy('guest', '123456')
printer.print()