Last active
December 26, 2018 04:18
-
-
Save rdcoder33/4e764efa74adfb708fcb11053f66f805 to your computer and use it in GitHub Desktop.
This file contains 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: | |
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