# 父类 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()
阅读: 19772
阅读: 16897 评论:1
阅读: 15997
阅读: 15888
阅读: 15479
阅读: 15245
扫扫关注微信