继承

class Zll(object):
def __init__(self):
self.money=100000000
self.house='3环里20'

def sing(self):
print('唱歌')

def dance(self):
print('跳广场舞')

def lm(self):
print('找朋友')

class Zxl(Zll):
def dance(self):
print('跳霹雳舞')

aa=Zxl()
aa.sing()
aa.dance()



class Base(object):
def __init__(self,host,port,password):
self.host=host,
self.port=port
self.password=password
class Mysql(Base):
pass

class Redis(Base):
pass
原文地址:https://www.cnblogs.com/jiadan/p/9090194.html