test-class.py 383 B

1234567891011121314151617181920212223
  1. class Animal:
  2. def __init__(self):
  3. self.eyes = 2
  4. def breathe(self):
  5. print("Inhail, exhail.")
  6. class Fish(Animal):
  7. def __init__(self):
  8. super().__init__()
  9. def breathe(self):
  10. super().breathe()
  11. print("under water.")
  12. def swim(self):
  13. print("Moving in water.")
  14. fish = Fish()
  15. fish.swim()
  16. fish.breathe()
  17. print(fish.eyes)