Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Railroad: | |
pass | |
def feed_animal(animal: BaseAnimal): | |
piece_of_railroad = Railroad() | |
animal.eat(piece_of_railroad) | |
lassie = Dog() | |
feed_animal(lassie) # It's safe, Lassie won't touch it anyway! |
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
from typing import Union | |
class Food: ... | |
class Meat(Food): ... | |
class Chocolate(Food): ... | |
class Dog: | |
def eat(self, food: Meat): | |
pass |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.