open类的初始化程序是否也需要打开? [英] Does the initializer of an `open` class need to be open as well?
本文介绍了open类的初始化程序是否也需要打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Swift 3引入了新的 open 关键字在框架中使用.
Swift 3 introduced the new open keyword that I'm using in a framework.
此框架中的open
类是否需要在该框架之外使用open
初始化程序,还是init函数继承该类的open
声明?
Does an open
class in this framework require an open
initialiser to be used outside of said framework, or does the init function inherit the open
declaration on the class?
例如:
open class OpenClass {
var A: String
init() { // does this init() function need to be marked open?
A = String()
}
}
其他问题:开放类OpenClass
中的变量是否继承了其类的开放性质?
Side question: do the variables in the open class OpenClass
inherit the open nature of their class?
推荐答案
查看全文