Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. class Fruit:
  2.     def eat(self):
  3.         print("You ate the "+self.get_name())
  4.     def get_name(self):
  5.         return "unknown fruit"
  6.  
  7. class Apple(Fruit):
  8.     def get_name(self):
  9.         return "apple"
  10.  
  11. a = Apple()
  12. a.eat()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement