Skip to content

Commit 98ac85b

Browse files
committed
状态模式
1 parent 0cffc58 commit 98ac85b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

design_patterns/state/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
/*
55
66
状态模式
7-
其实就是状态机,根据当前状态执行不同功能
8-
将复杂的行为分离开,解除耦合
7+
这个就是状态机,这里C++更封装了一层,将具体的各个状态的行为都封装到一个子类去。
8+
这样修改某一状态的代码就只需要修改这个子类就可以了。这样大大降低了耦合
9+
910
1011
1112
*/

0 commit comments

Comments
 (0)