美文网首页
百宝箱 2.3 protected

百宝箱 2.3 protected

作者: RealAnalysis | 来源:发表于2020-02-19 09:23 被阅读0次

网址变成乱码的过程,发现model里面改定义时加了一个“protected”,跟用过的“private”一样的位置,应该是有作用的

好奇之下,删掉了这个protected再尝试打开网站,还是正常运作,嗯嗯,看来这个作用比较隐晦啊...跑去查了点资料 明确了一些

Public


Private


Protected


In Summary, use private methods for internal usage without a receiver, and protected methods defined as self.method_name for internal usage in other classes whenever inheritance isn’t set up.

相关文章

网友评论

      本文标题:百宝箱 2.3 protected

      本文链接:https://www.haomeiwen.com/subject/stvhfhtx.html