class GrandPa:
def __init__(self):
print('I'm GrandPa')
class Father(GrandPa):
def __init__(self):
print('I'm Father!')
class Son(Father):
"""A simple example class"""
i = 12345
def __init__(self):
print('这是构造函数,son')
def sayHello(self):
return 'hello world'
if __name__ == '__main__':
son = Son()
# 类型帮助信息
print('类型帮助信息: ',Son.__doc__)
#类型名称
print('类型名称:',Son.__name__)
#类型所继承的基类
print('类型所继承的基类:',Son.__bases__)
#类型字典
print('类型字典:',Son.__dict__)
#类型所在模块
print('类型所在模块:',Son.__module__)
#实例类型
print('实例类型:',Son().__class__)
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
这是构造函数,son
类型帮助信息: A simple example class
类型名称: Son
类型所继承的基类: (<class '__main__.Father'>,)
类型字典: {'__module__': '__main__', 'sayHello': <function Son.sayHello at 0x010194F8>, '__doc__': 'A simple example class', '__init__': <function Son.__init__ at 0x010194B0>, 'i': 12345}
类型所在模块: __main__
这是构造函数,son
实例类型: <class '__main__.Son'>
>>>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有