1.继承 class Father: def init(self,age,sex): self.age = age self.sex = sex class Son(Father): 类名后面写括号,括号中放父类名. pass class Dog(默认继承object类):所有类的父类 pass 不可以访问父类私有属性.双下划线属性.除非在内部定义一个super().__私有属性,的方法访问. class Son(Father): def bb(self): print(Father.__a)…
看上去好像挺烦人,但只要通过例子测试一下,就明白了.不做测试,只是看,第二天还是不明白.当然我在抄其他人的日志,然后希望能是自己的理解就好,原文地址PHP的魔术方法和魔术敞亮简介和使用--LaraBot 魔术方法(Magic methods) In PHP, methods start with two "_"is called magic methods, these methods act as very important role, magic method includes:…