I found some info of the designated initializer in this Apple's docs, but what I don't understand is, must each class have one and only one designated initializer?
For example, what if class A
has initL, initM, initN
, while class B
inherits from class A
and has initX, initY, initZ
. Is there a rule that says we can't have initX
call [super initL]
, and initY
call [super initM]
, and initZ
call [super initN]
?
That is, instead of all "secondary initializers" call the designated initializer, and then each designated initializer will call the [super initFoo]
where initFoo
is the superclass's designated initializer, can't we just have 3 primary initializers, and each one caller its corresponding superclass's 3 primary initializers? (and say, these all inherit from NSObject
and just call self = [super init]
.)