- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass_2.py
More file actions
Latest commit
60 lines (41 loc) · 927 Bytes
/
Copy pathclass_2.py
File metadata and controls
60 lines (41 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 18 09:27:19 2017
@author: omf
"""
classstudent():
pass
classstudent2(object):
def__init__(self,name='jie',score='100'):
self.name=name
self.score=score
a=student()
print(type(a))
a=student2('hello',100)
print(a.name,a.score)
classStudent(object):
def__init__(self, name, score):
self.name=name
self.score=score
defget_grade(self):
ifself.score>=90:
return'A'
elifself.score>=60:
return'B'
else:
return'C'
#base class super class
classanimal(object):
def__init__(self):
pass
defrun(self):
print('animal is runing... ')
classdog(animal):
defrun(self):
print('dog is running...')
defeat(self):
print('dog meat')
classcat(animal):
pass
a=dog()
print(a.run())