Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update structural.rst #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions structural_patterns/structural.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
象结合在一起形成更大的结构,就像搭积木,可以通过
简单积木的组合形成复杂的、功能更为强大的结构。

结构型模式可以分为类结构型模式和对象结构型模式:

- 类结构型模式关心类的组合,由多个类可以组合成一个更大的
系统,在类结构型模式中一般只存在继承关系和实现关系。
- 对象结构型模式关心类与对象的组合,通过关联关系使得在一
个类中定义另一个类的实例对象,然后通过该对象调用其方法。
根据“合成复用原则”,在系统中尽量使用关联关系来替代继
承关系,因此大部分结构型模式都是对象结构型模式。
结构型模式可以分为类结构型模式和对象结构型模式:

- 类结构型模式关心类的组合,由多个类可以组合成一个更大的系统,在类结构型模式中一般只存在继承关系和实现关系。
- 对象结构型模式关心类与对象的组合,通过关联关系使得在个类中定义另一个类的实例对象,然后通过该对象调用其方法。

根据“合成复用原则”,在系统中尽量使用关联关系来替代继承关系,因此大部分结构型模式都是对象结构型模式。


**包含模式**

Expand Down