今天学了python的类。。
给个最简单的例子(综合了所有关于类的基本知识):
|
1
2
3
4
5
6
7
8
9
10
11
12
13 |
class
Person: def
setName(self,name): self.name=name def
getName(self): return
self.name def
sysHello(self): print
‘hello,‘,repr(self.name) def
_cannotSee(self): print
‘sorry ‘+self.name+‘, you can not see it!‘<br><br>class
Woman(Person):<br> del
sex(self):<br> self.sex="woman"<br><br> |
此篇博文 未完成。。。待续
原文:http://www.cnblogs.com/ben-zuo/p/3578989.html