# 父类 class User: # 定义属性 uid = 0 name = '' # 子类(继承User类) class Student (User): # 定义方法 def show(self): print(str(self.uid) + self.name) # 定义静态方法 @staticmethod def Hi(): print('Hi') stu = Student() stu.uid = 123 stu.name = '李四' stu.show() Student.Hi()
阅读: 20056
阅读: 17190 评论:1
阅读: 16364
阅读: 16342
阅读: 15747
阅读: 15516
扫扫关注微信