OnJava8-Examples/generics/DogsAndRobots.py

29 lines
459 B
Python
Raw Normal View History

2015-05-05 11:20:13 -07:00
#: generics/DogsAndRobots.py
2015-05-29 14:18:51 -07:00
# <20>2015 MindView LLC: see Copyright.txt
2015-05-05 11:20:13 -07:00
class Dog:
def speak(self):
print("Arf!")
def sit(self):
print("Sitting")
def reproduce(self):
pass
class Robot:
def speak(self):
print("Click!")
def sit(self):
print("Clank!")
def oilChange(self):
pass
def perform(anything):
anything.speak()
anything.sit()
a = Dog()
b = Robot()
perform(a)
perform(b)
#:~