#!/usr/bin/env python class Animal(object): nane = ‘rrrr‘ def __init__(self): self.name = 66666 print(self.name) def greet(self): print (‘Hello, I am %s.‘ % self.name) @classmethod def jk(self): print(33333333) self.hk() @staticmethod def hk(): print(4444444) class a(Animal): def greet(self): super(a,self).__init__() super(a,self).greet() print(99999999) #d = Animal(‘yyyy‘) a().greet()
必须要实例化一个对象才可以a类里面的greet方法,否则就会一直报错缺少self参数,小编一直调试函数的参数,但是还是无济于事,最后实例化a类后才可以正常调用