Skip to content

Commit 83647ed

Browse files
committed
类继承
1 parent 067b8d0 commit 83647ed

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test_class.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys,string
2+
class A1:
3+
def a1(self):
4+
print 'use A1 a1'
5+
def a3(self):
6+
print 'user A1 a3'
7+
8+
class A2(A1):
9+
def a1(self):
10+
print 'use A2 a1'
11+
def a2(self):
12+
print 'user A2 a2'
13+
14+
a=A1()
15+
a.a1()
16+
a.a3()
17+
18+
print '==============='
19+
b=A2()
20+
b.a1()
21+
b.a2()
22+
b.a3()
23+

0 commit comments

Comments
 (0)