classandinheritanceclassBase:def__init__(self):self.data=[]defadd(self,x):self.data.append(x)defaddtwice(self,x):self.add(x)self.add(x)#ChildextendsBaseclassChild(Base):defplus(self,a,b):returna+boChild=Child()oChild.add("str1")oChild.addtwice("up")...
查看全文