-
Notifications
You must be signed in to change notification settings - Fork 0
/
class_2.py
60 lines (41 loc) · 927 Bytes
/
class_2.py
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
"""
class student():
pass
class student2(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)
class Student(object):
def __init__(self, name, score):
self.name = name
self.score = score
def get_grade(self):
if self.score >= 90:
return 'A'
elif self.score >= 60:
return 'B'
else:
return 'C'
#base class super class
class animal(object):
def __init__(self):
pass
def run(self):
print('animal is runing... ')
class dog(animal):
def run(self):
print('dog is running...')
def eat(self):
print('dog meat')
class cat(animal):
pass
a=dog()
print(a.run())