
![]() | Declare a base class MyBase:
class MyBase:
def __init__(self,i,j): # constructor
self.i = i; self.j = j
def write(self): # member function
print 'MyBase: i=',self.i,'j=',self.j
|
![]() | self is a reference to this object |
![]() | Data members are prefixed by self: self.i, self.j |
![]() | All functions take self as first argument in the
declaration, but not in the call
inst1 = MyBase(6,9); inst1.write() |