类
starry_lucky
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
类和对象
定义 class student():#类 方法 函数 等 a = student()#对象 初始化 class student(): school = '北京大学' def __init__(self,name,a): id = self.id name = self.name self._a = a#隐藏属性 age = 18 a = student('haha') 1.如果需要取到该对原创 2020-12-19 17:39:18 · 181 阅读 · 1 评论 -
类详解
1.类的继承 仅继承类,但不使用属性 class Person(object): _city = 'beijing' def __init__(self, name): self._name = name class Student(Person): def __init__(self,score):#init会被标黄 self.score = score a = Student(120) 继承类的属性,并使用 class Person(原创 2020-12-28 14:30:08 · 269 阅读 · 2 评论
分享