#!/usr/bin/python
class Person:
name = "no name"
age = -1
__color="yellow"
def speak(self):
print "I am "+self.name
def run(self1):
print self1.name+" is running"
def getColor(self):
print "my color is:"+self.__color
zhangsan = Person()
zhangsan.speak()
zhangsan.run()
zhangsan.name="lisi"
zhangsan.speak()
zhangsan.high=1.78
print zhangsan.high
print zhangsan.getColor()
python面向对象1
最新推荐文章于 2014-02-20 14:20:52 发布