多继承
""" Mother.py 多继承类 inherited Animal python (类名) super java 继承可以使用 extends 和 implements 这两个关键字来实现继承 C++ :public 类名 C# :类名 可以重写父类方法 edit:geovindu,Geovin Du date:20230702 IDE:PyCharm 2023.1.2 """ import sys import os import Father class Mother(object): def __init__(self,faceValue): self._facevalue=faceValue @property def FaceValue(self): return self._facevalue @FaceValue.setter def FaceValue(self,facevalue): self._facevalue=facevalue """ Father.py 多继承类 inherited Animal python (类名) super java 继承可以使用 extends 和 implements 这两个关键字来实现继承 C++ :public 类名 C# :类名 可以重写父类方法 edit:geovindu,Geovin Du date:20230702 IDE:PyCharm 2023.1.2 """ import sys import os class Father(object): def __init__(self,money): self._money=money @property def Money(self): return self._money @Money.setter def Money(self,money): self._money=money """ Son.py 多继承类 inherited Animal python (类名) super java 继承可以使用 extends 和 implements 这两个关键字来实现继承 C++ :public 类名 C# :类名 可以重写父类方法 edit:geovindu,Geovin Du date:20230702 IDE:PyCharm 2023.1.2 """ import sys import os import Father import Mother class Son(Father.Father,Mother.Mother): def __init__(self,money:str,faceValue:str,work:str): """ 多继承的用法 :param money: :param faceValue: :param work: """ self._work=work Father.Father.__init__(self,money) Mother.Mother.__init__(self,faceValue) @property def Work(self): return self._work @Work.setter def Work(self,work): self._work=work def Personality(self): print(f"{self.Money}{self.FaceValue}{self._work}")
单继承:
class Gold(object): """ """ def __init__(self,name:str,color:str): self._name=name self._color=color def intrudce(self): print(f"") import Gold class GoldPear(Gold.Gold): def __init__(self,name:str,color:str,category:str): super().__init__(name,color) self._category=category
标签:__,multiple,inheritance,python,money,self,._,import,def From: https://www.cnblogs.com/geovindu/p/17520934.html