Object-Oriented Programs 14 7
values for its two instance variables. The following code shows the definition
of this subclass.
52 class Staff (University_employee):
53 ’Subclass of University_employee’
54 staffcount = 0
55
56 def __init__(self, name, datas, phone, position,
train_level):
57 University_employee.__init__(self, name, datas,
phone)
58 self.position = position
59 self.train = train_level
60 Staff.staffcount += 1
61
62 def getPos(self):
63 return self.position
64
65 def setPos(self, npos):
66 self.position = npos
67
68 def getTrain(self):
69 return self.train
70
71 def setTrain(self, ntrainl):
72 self.train = ntrainl
9.9.3 Example Objects
In the following code, objects of the base class and the two subclasses are
created and methods of these objects are