Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created September 26, 2022 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magickatt/00d9719206d5a9d51422a4f57fbd1f01 to your computer and use it in GitHub Desktop.
Save magickatt/00d9719206d5a9d51422a4f57fbd1f01 to your computer and use it in GitHub Desktop.
Silly example of method overriding using the parent return value
class Animal:
def what_am_i(self) -> str:
return "I am a "
class Fox(Animal):
def what_am_i(self) -> str:
return super().what_am_i() + "Fox"
fox = Fox()
print(fox.what_am_i())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment