apl-mhd

Inheritance

Jan 21st, 2019
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Bird:
  2.  
  3.  
  4.     def __init__(self):
  5.         print("brid is ready")
  6.  
  7.  
  8.     def whoIsThis(self):
  9.         print("BIRD")
  10.  
  11.     def swim(self):
  12.         print("swim can faster")
  13.  
  14.  
  15. class Penguin(Bird):
  16.  
  17.     def __init__(self):
  18.         super().__init__()
  19.         print("Now penguin child class is ready")
  20.  
  21.     def whoIsThis(self):
  22.         print("penguin")
  23.  
  24.     def swim(self):
  25.         print("wim Faster")
  26.  
  27.  
  28. peggy = Penguin()
  29.  
  30. peggy.whoIsThis()
  31. peggy.swim()
RAW Paste Data