# Coding:utf-8# author:我本善良# create_time:2021/5/30 16:32'''python中封装的概念 将不对外的私有属性或方法通过可对外使用的函数而使用(类中定义私有的,只有类内部使用,外部无法访问) 这样做的主要原因是:保护隐私,明确区分内外'''class Parent(object): def __hello(self,data): print('hello %s' % data) def helloworld(self): self.__hello('world')parent1 = Parent()parent1.helloworld()
总结 以上是内存溢出为你收集整理的python-python中的封装概念全部内容,希望文章能够帮你解决python-python中的封装概念所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)