def iven(self,name = "iven"): print "hello,%s"%name
def jack(self,name = "jack"): print "hello,%s"%name def lusy(self,name = "lusy"): print "hello,%s"%name
class GrandPa(object): @property def gp(self): print "GrandPa!" class Father(GrandPa): @property def ft(self): print "Father!" class Son(Father): @property def son(self): print "Son!"
Family =type("Family",(Son,Father,GrandPa),dict(Chris_iven = iven,Chris_jack = jack,Chris_lusy = lusy))
me = Family() me.Chris_iven() me.Chris_jack() me.Chris_lusy()
#我发现可以obejct和dict那里可以添加多个!
Sign in to make a reply
神月宗
-- coding:utf-8 --
def iven(self,name = "iven"): print "hello,%s"%name
def jack(self,name = "jack"): print "hello,%s"%name def lusy(self,name = "lusy"): print "hello,%s"%name
class GrandPa(object): @property def gp(self): print "GrandPa!" class Father(GrandPa): @property def ft(self): print "Father!" class Son(Father): @property def son(self): print "Son!"
Family =type("Family",(Son,Father,GrandPa),dict(Chris_iven = iven,Chris_jack = jack,Chris_lusy = lusy))
me = Family() me.Chris_iven() me.Chris_jack() me.Chris_lusy()
#我发现可以obejct和dict那里可以添加多个!