Skip to content

Commit 2b92cb7

Browse files
author
guiyin.xiong
committed
test codes class_learn.py
1 parent 40520b0 commit 2b92cb7

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

codes/class_learn.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
3+
class Door:
4+
def __init__(self,number,status):
5+
self.number = number
6+
self.status = "closed"
7+
8+
def open(self):
9+
self.status = "openning"
10+
11+
def close(self):
12+
self.status = "closed"
13+
14+
door = Door(1001,"closed")
15+
door.open()
16+
print(door.status)
17+
Door.close(door)
18+
print(door.status)
19+
20+

0 commit comments

Comments
 (0)