Skip to content

Instantly share code, notes, and snippets.

@imhoffd
Created February 9, 2015 15:42
Show Gist options
  • Save imhoffd/9a4f7b0ae71bdfaaac3e to your computer and use it in GitHub Desktop.
Save imhoffd/9a4f7b0ae71bdfaaac3e to your computer and use it in GitHub Desktop.
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