OnJava8-Examples/staticchecking/DogsAndRobots.py
Bruce Eckel 49edcc8b17 reorg
2015-06-15 17:47:35 -07:00

21 lines
320 B
Python

#: staticchecking/DogsAndRobots.py
# ©2015 MindView LLC: see Copyright.txt
def speak(anything):
anything.talk()
class Dog:
def talk(self): print("Arf!")
def reproduce(self): pass
class Robot:
def talk(self): print("Click!")
def oilChange(self): pass
a = Dog()
b = Robot()
speak(a)
speak(b)
#:~