-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFacade.py
More file actions
55 lines (41 loc) · 960 Bytes
/
Facade.py
File metadata and controls
55 lines (41 loc) · 960 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# @Time : 2022/08/24 15:41:27
# @Author : Gary
# @Email : None
class CPU:
# 子系统类
def run(self):
print('CPU start to run...')
def stop(self):
print('CPU stop to run...')
class Disk:
# 子系统类
def run(self):
print('Disk start to run...')
def stop(self):
print('Disk stop to run...')
class Memory:
# 子系统类
def run(self):
print('Memory start to run...')
def stop(self):
print('Memory stop to run...')
class Computer():
# 外观
def __init__(self):
self.CPU = CPU()
self.Disc = Disk()
self.Member = Memory()
def run(self):
self.CPU.run()
self.Disc.run()
self.Member.run()
def stop(self):
self.CPU.stop()
self.Disc.stop()
self.Member.stop()
# 客户端,高层代码
c = Computer()
c.run()
c.stop()