Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
I’m only commenting because the actual python is practically pseudo code:
# A turtle classclassTurtle:
shell=True# A boss classclassBoss:
authority=True#A class that inherits from anotherclassTigerTurtle(Turtle):
fuzzy=True# Multiple inheritance, or "The Devil's Playground"classTigerBossTurtle(TigerTurtle, Boss):
# shell, authority, and fuzzy are all true
...
Inheritance established “is a” relationship between classes.
Underlying classes hold an inner object to the super class, everything from Turtle will be in TigerTurtle and BossTurtle.
In some languages that is configurable with public, private, protected keywords.
Relatedly, there’s also composition, which establishes a “has a” relationship:
Since Turtle is NOT a tail, but a whole animal, turtle should not inherit TurtleTail. But it HAS a tail, thus we add turtle tail as a property.
I’m only commenting because the actual python is practically pseudo code:
# A turtle class class Turtle: shell=True # A boss class class Boss: authority=True #A class that inherits from another class TigerTurtle(Turtle): fuzzy=True # Multiple inheritance, or "The Devil's Playground" class TigerBossTurtle(TigerTurtle, Boss): # shell, authority, and fuzzy are all true ...
It is simpler than my faulty memory remembers, time to learn python again 😁