摘要: 封装方法: 给方法名字前面加上双下划线 封装方法的好处:.1.提高安全性2.隔离复杂度 (将复杂的内容隔离到内部 外部只留下简单的接口) 1 class ATM: 2 def __insert_card(self): 3 print("插入银行卡...") 4 5 def __input_pwd(s 阅读全文
posted @ 2018-12-18 16:32 yyf1 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 面向对象的精髓:是将数据和处理数据的代码绑定在一起,成为一个对象 只要获取到对象,相应的数据和方法都有 1 class Mysql: 2 def __init__(self,host,port,db,charset): 3 self.host = host 4 self.port = port 5 阅读全文
posted @ 2018-12-18 15:33 yyf1 阅读(152) 评论(0) 推荐(0) 编辑