Skip to content

Instantly share code, notes, and snippets.

@rdcoder33
Last active December 26, 2018 04:18
Show Gist options
  • Save rdcoder33/4e764efa74adfb708fcb11053f66f805 to your computer and use it in GitHub Desktop.
Save rdcoder33/4e764efa74adfb708fcb11053f66f805 to your computer and use it in GitHub Desktop.
class Animal:
def __init__(self, name, species):
self.name = name
self.species = species
def speak(self):
return 'blah blah'
class Dog(Animal):
def __init__(self, name, species, color):
super().__init__(name, species)
self.color = color
def speak(self):
return 'bow bow'
class Cat(Animal):
def __init__(self, name, species, color):
super().__init__(name, species)
def speak(self):
return 'meow meow'
snow = Dog('snow', 'mammal', 'white')
oscar = Cat('oscar', 'mammal)
print(snow.speak)
print(oscar.speak)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment