私有和文件私有顶级类之间的区别 [英] Distinction between private and fileprivate top-level classes
本文介绍了私有和文件私有顶级类之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Swift 3中,访问控制的确切区别是
In Swift 3, what exactly is the difference in access control between
private class Foo { }
和
fileprivate class Bar { }
假设这两个都是顶级类,也就是说,它们直接放在一个文件而不是嵌套在其他结构中?
assuming both are top-level classes, that is, they are placed directly into a file rather than nested in some other construct?
推荐答案
您的情况没有区别。 fileprivate
与
There is no difference in your case. The only time that fileprivate
differs from private
is inside a class, struct, or protocol.
这篇关于私有和文件私有顶级类之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文