class Arithmetic(object): def add_num(self,a,b): print a+b class String(object): def add_num(self,a,b): print a-b def print_string_upper(self,data): print data.upper() class Common(Arithmetic,String): def print_class_c(self): print "This is C" print Common.mro() mih=Common() mih.add_num(2,3) #Following MRO mih.print_string_upper("python") mih.print_class_c()
Output:
[<class '__main__.Common'>, <class '__main__.Arithmetic'>, <class '__main__.String'>, <type 'object'>] 5 PYTHON This is C
0 comments:
Post a Comment