|
@@ -3,23 +3,27 @@
|
|
|
|
|
|
"""http://ginstrom.com/scribbles/2008/11/06/generic-adapter-class-in-python/"""
|
|
"""http://ginstrom.com/scribbles/2008/11/06/generic-adapter-class-in-python/"""
|
|
|
|
|
|
-import os
|
|
|
|
|
|
|
|
class Dog(object):
|
|
class Dog(object):
|
|
def __init__(self):
|
|
def __init__(self):
|
|
self.name = "Dog"
|
|
self.name = "Dog"
|
|
|
|
+
|
|
def bark(self):
|
|
def bark(self):
|
|
return "woof!"
|
|
return "woof!"
|
|
|
|
|
|
|
|
+
|
|
class Cat(object):
|
|
class Cat(object):
|
|
def __init__(self):
|
|
def __init__(self):
|
|
self.name = "Cat"
|
|
self.name = "Cat"
|
|
|
|
+
|
|
def meow(self):
|
|
def meow(self):
|
|
return "meow!"
|
|
return "meow!"
|
|
|
|
|
|
|
|
+
|
|
class Human(object):
|
|
class Human(object):
|
|
def __init__(self):
|
|
def __init__(self):
|
|
self.name = "Human"
|
|
self.name = "Human"
|
|
|
|
+
|
|
def speak(self):
|
|
def speak(self):
|
|
return "'hello'"
|
|
return "'hello'"
|
|
|
|
|
|
@@ -27,6 +31,7 @@ class Human(object):
|
|
class Car(object):
|
|
class Car(object):
|
|
def __init__(self):
|
|
def __init__(self):
|
|
self.name = "Car"
|
|
self.name = "Car"
|
|
|
|
+
|
|
def make_noise(self, octane_level):
|
|
def make_noise(self, octane_level):
|
|
return "vroom{0}".format("!" * octane_level)
|
|
return "vroom{0}".format("!" * octane_level)
|
|
|
|
|