您不能使用type
basePresenterProtocol?属性来实现type
的读写属性要求
DashboardPresenterProtocol?。
考虑这是否会发生什么 是
可能的,你上溯造型的一个实例,并
DashboardPresenter到
DashboardViewProtocol。您将能够分配符合
basePresenterProtocol类型属性的任何内容,
DashboardPresenterProtocol?这将是非法的。
因此,读写属性要求 _必须_是不变的(尽管值得注意的是,只读属性要求应该可以是协变的,但是当前不支持。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)