https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-ID203
superClass的initializers可選擇繼承
好處:
1.屏蔽一些功能
如: super:長方形 sub: 正方形
super中有長和寬的initializer,在sub中不應該有這個initializer
建議:
繼承時先考慮要不要繼承初始化方法
以下是默認全繼承的條件:
保證了所有初始化方法都是安全的
Assuming that you provide default values for any new properties you introduce in a subclass, the following two rules apply:
Rule 1
If your subclass doesn’t define any designated initializers, it automatically inherits all of its superclass designated initializers.
Rule 2
If your subclass provides an implementation of all of its superclass designated initializers—either by inheriting them as per rule 1, or by providing a custom implementation as part of its definition—then it automatically inherits all of the superclass convenience initializers.