课程
/后端开发
/Python
/python进阶
一个问题: 在__init__()中,将score变成了私有属性self.__score = score 为什么在grade()中是使用self.score而不是使用self.__score,而且这两种方式都有效??
2015-10-09
源自:python进阶 6-7
正在回答
grade()中使用 self.score 相当于调用get_score() return self.__score,与直接self.__score效果一样
举报
学习函数式、模块和面向对象编程,掌握Python高级程序设计
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号