Skip to content

Commit

Permalink
类名第二部分。
Browse files Browse the repository at this point in the history
Signed-off-by: 庞博 <[email protected]>
  • Loading branch information
庞博 committed Apr 24, 2015
1 parent 398763b commit ee0f018
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion translation/5-类.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ As you may already have noticed, in this book the class (but not only) prefix is

There is another good practice that you might want to follow while choosing the name for your classes: when you're creating a subclass, you should put the specifying name part between the class prefix and the superclass name. This is better explained with an example: if you have a class named `ZOCNetworkClient`, example of subclass name will be `ZOCTwitterNetworkClient` (note "Twitter" between "ZOC" and "NetworkClient"); or, following the same rule, a `UIViewController` subclass would `ZOCTimelineViewController`.

这里有另外一个你应该遵守来命名你的类的实践:当你创建一个子类的时候,你应该把它的特定的名字作为类前缀,把超类的名字放在中间。举个例子:如果你有一个 `ZOCNetworkClient` 类,子类的名字会是`ZOCTwitterNetworkClient` (注意 "Twitter" 在 "ZOC" 和 "NetworkClient" 之间); 按照这个约定, 一个`UIViewController` 的子类会是 `ZOCTimelineViewController`.
另一个类的命名规范:当你创建一个子类的时候,你应该把说明性的部分放在前缀和父类名的在中间。举个例子:如果你有一个 `ZOCNetworkClient` 类,子类的名字会是`ZOCTwitterNetworkClient` (注意 "Twitter" 在 "ZOC" 和 "NetworkClient" 之间); 按照这个约定, 一个`UIViewController` 的子类会是 `ZOCTimelineViewController`.


## Initializer and dealloc 初始化和释放
Expand Down

0 comments on commit ee0f018

Please sign in to comment.