On Dec 22, 2009, at 12:31, Floris van Manen wrote:

class OpEnAf:
        def __init__(self, v)
                self.v = v
        def erbij(self, x):
                self.v += x
        def eraf(self, x):
                self.v -= x
        def show(self):
                print 'Tussenstand:', self.v

a = OpEnAf( 10 )
a.show()

a.erbij(100)
a.show()

a.eraf(20)
a.show()

for i in range(10):
        a.erbij(i)
        print i, 'erbij is', a.v

a.show()



_______________________________________________
Python-nl mailing list
Python-nl@python.org
http://mail.python.org/mailman/listinfo/python-nl

Antwoord per e-mail aan