python学习2-对象引用

Helloword.py
#!/usr/bin/env python
#codeing utf-8
class Helloword:
  count = 100;
  def  __init__(self,count):
    self.count=count;

  def add(self,a):
    return self.count+a;

h=Helloword(1000);
a=h.add(1);
print a;

spython.py
#!/usr/bin/env python
#codeing utf-8
import Helloword
h=Helloword.Helloword(1000);
a=h.add(1);
print a;

猜你喜欢

转载自lxlcx201.iteye.com/blog/2407358