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