SHARE
TWEET

Python Single and Multilevel inheritance

a guest Aug 26th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Emp:
  2.     def __init__(s, sal, name, eid):
  3.         s.sal = sal
  4.         s.name = name
  5.         s.eid = eid
  6.    
  7.     def aaa(s):
  8.         print("Name ",s.name)
  9.         print("Sal ",s.sal)
  10.         print("Eid ",s.eid)
  11.  
  12.  
  13. class Prog(Emp):
  14.     def __init__(s, cod, time ,sal, name, eid):
  15.         Emp.__init__(s, sal, name, eid)
  16.         s.cod = cod
  17.         s.time = time
  18.        
  19.     def printDetail2(s):
  20.         Emp.aaa(s)
  21.         print("Cod ",s.cod)
  22.         print("Time ",s.time)
  23.  
  24. class Tester(Prog):
  25.     def __init__(s, tester, ttest, cod, time ,sal, name, eid):
  26.         Prog.__init__(s, cod, time, sal, name, eid)
  27.         s.tester = tester
  28.         s.ttest = ttest
  29.    
  30.     def printDetail2(s):
  31.         Emp.aaa(s)
  32.         print("tester ",s.tester)
  33.         print("TTest ",s.ttest)
  34.        
  35.  
  36. a  = Tester("no", 89, "true", 67, 12,"aSas", 4)
  37. a.printDetail2()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top