class Mother:
pass
class Son(Mother):
def __init__(self):
print(self.__class__.__name__)
m = Mother()
s = Son()
print(m.__class__.__name__)
print(s.__class__.__name__)
print(Son.__class__.__name__)
print(Son().__class__.__name__)
输出:
Son
Mother
Son
type
Son
Son