OnJava8-Examples/generics/DogsAndRobots.py
2015-11-03 12:00:44 -08:00

27 lines
466 B
Python

# generics/DogsAndRobots.py
class Dog:
def speak(self):
System.out.println("Arf!")
def sit(self):
System.out.println("Sitting")
def reproduce(self):
pass
class Robot:
def speak(self):
System.out.println("Click!")
def sit(self):
System.out.println("Clank!")
def oilChange(self):
pass
def perform(anything):
anything.speak()
anything.sit()
a = Dog()
b = Robot()
perform(a)
perform(b)