擅长:python、mysql、java
<p>如果你还没有找到它,这里是<a href="http://diveintopython.net/object_oriented_framework/index.html" rel="noreferrer">Dive into Python's chapter on object-oriented programming</a>。</p>
<p>这里还有一些<a href="http://wiki.python.org/moin/SimplePrograms" rel="noreferrer">examples</a>,滚动到BankAccount。</p>
<hr/>
<p>可以直接调用类来创建实例。参数被传递给<code>__init__</code>方法。</p>
<pre><code>class Tamago(object):
def __init__(self, name):
self.name = name
imouto = Tamago('imouto')
oba = Tamago('oba')
oba.name # 'oba'
imouto.name # 'imouto'
</code></pre>