In [24]:
"ram" +"venkat"
Out[24]:
In [25]:
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
e=Emp()
e.disworkhours()
In [26]:
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
e=Emp()
e.setworkhours()
e.disworkhours()
In [12]:
# over riding
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
class trai(Emp):
def setworkhours(self):
self.workhours=40
e=Emp()
e.setworkhours()
e.disworkhours()
In [28]:
# over riding
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
class trai(Emp):
def setworkhours(self):
self.workhours=40
e=Emp()
e.setworkhours()
print("emp work hours")
e.disworkhours()
t=trai()
t.setworkhours()
print("Trainee work hours")
t.disworkhours()
In [20]:
# over riding
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
class trai(Emp):
def setworkhours(self):
self.workhours=40
def reset(self):
super().setworkhours()
e=Emp()
e.setworkhours()
print("emp work hours")
e.disworkhours()
t=trai()
t.setworkhours()
print("Trainee work hours")
t.disworkhours()
In [29]:
# over riding
class Emp():
def setworkhours(self):
self.workhours=30
def disworkhours(self):
print("work hours",self.workhours)
class trai(Emp):
def setworkhours(self):
self.workhours=40
def reset(self):
super().setworkhours()
e=Emp()
e.setworkhours()
print("emp work hours")
e.disworkhours()
t=trai()
t.setworkhours()
print("Trainee work hours")
t.disworkhours()
t.reset()
print("Trainee work hours")
t.disworkhours()