Convenience Init Override

≯℡__Kan透↙ 提交于 2019-11-30 17:27:59

The reason override is unneeded:

Conversely, if you write a subclass initializer that matches a superclass convenience initializer, that superclass convenience initializer can never be called directly by your subclass, as per the rules described above in Initializer Chaining. Therefore, your subclass is not (strictly speaking) providing an override of the superclass initializer. As a result, you do not write the override modifier when providing a matching implementation of a superclass convenience initializer.

But as written, it seems it should work — as far as I can tell this is a compiler bug. If you change the name of the array argument to ClassB's initializer to e.g. array2, then it works as expected. You should file a Radar!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!