-
-
Save jeffs/e250a3d40b9b46a38b687b16add06ddb to your computer and use it in GitHub Desktop.
nested-polymorphism-virtual-py
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 BlackjackDealer: | |
def draw(self): | |
return "🃏" | |
class Cartoonist: | |
def draw(self): | |
return "🖼️" | |
if __name__ == '__main__': | |
from sys import argv | |
print(globals()[argv[1]]().draw()) |
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
$ python3 virtual.py BlackjackDealer | |
🃏 | |
$ python3 virtual.py Cartoonist | |
🖼️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment