摘要:
假设一个数据有三个部分显示数据的, 分别是 max, min,average,我们可以写下这个一个类: 1 class Datashow 2 { 3 public: 4 void measurmentChanged 5 { 6 float temp = getTemplate(); 7 float humidity = getHumdity(); 8 float pressure = getPressure(); 9 10 average.updata(temp, humidity, pressure); 11 max.updata(temp, humidity, pressure); 12. 阅读全文
摘要:
1 class Person: 2 population = 0 3 def __init__(self, name): 4 self.name = name 5 Person.population += 1 6 def __del__(self): 7 print 'now,%d destory'%Person.population 8 print "\n" 9 def sayHi(self): 10 print 'Hello, how are you%d'%Person.population 11 print "\n" 阅读全文