本文介绍了private 和 fileprivate 顶级类的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在 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?

推荐答案

您的情况没有区别.fileprivateprivate 唯一不同的地方是在类、结构或协议中.

There is no difference in your case. The only time that fileprivate differs from private is inside a class, struct, or protocol.

这篇关于private 和 fileprivate 顶级类的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 02:39