Created
February 9, 2015 15:42
-
-
Save imhoffd/9a4f7b0ae71bdfaaac3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
pass | |
# def __init__(self, name=None): | |
# print("IN ANIMAL") | |
# self.name = name | |
# self.position = (0, 0) | |
class Moveable: | |
def __init__(self, name=None): | |
print("IN MOVEABLE") | |
self.name = "Pig" | |
self.position = (0, 0) | |
def move(self, x, y): | |
self.position = (self.position[0] + x, self.position[1] + y) | |
class Cat(Animal, Moveable): | |
def __init__(self, name=None): | |
super(Cat, self).__init__(name=name) | |
c = Cat(name="Chevy") | |
print(c.name) | |
print(c.position) | |
c.move(5, 4) | |
print(c.position) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment