Skip to content

Instantly share code, notes, and snippets.

@holman
Created December 9, 2014 22:29
Show Gist options
  • Save holman/e3957414e582ca0f9b70 to your computer and use it in GitHub Desktop.
Save holman/e3957414e582ca0f9b70 to your computer and use it in GitHub Desktop.
Examples you could use in order to better explain your programming language inheritance and OOP syntax instead of using cars, animals, and shapes.
  • Cats, as defined by how important they were as plot devices (the cat from The Matrix would inherit from ImportantCat, whereas the cat from Boondock Saints would inherit from DeadCat)
  • Batman (primarily as a way to describe situations in which a child has no parents)
  • Presidents of the United States (Nixon vs Cheney vs Garfield)
  • Zombies (Walking Dead vs World War Z vs Zombieland)
  • Zombie Presidents of the United States
  • Children in television shows, as grouped by whether they actually did cause their parents' separation
  • Radioactive attack squirrels bent on global hegemony, beamed down to Earth from the mirror universe USS Enterprise
  • George Carlins by decade
  • Cocaine
  • Metropolises, cities, towns, villages, and Detroits
  • Responsible journalists, and the people who write for Gawker
  • The people who make money on the internet and the people who aggressively defend their programming language choices over Twitter
  • A Box that self-inherits from Boxed that inherits from Cube that inherits from Box, because who needs new programmers anyway
  • Strawberries, and how if you cut a batch of fresh strawberries your knife slides right through them, gently caressing the form into quartiles of bright, red, delicious chunks, each with their own story, each with their own charming existence, each yearning to enter your stomach but not until they put forth such an aroma of fresh-cut strawberry smells that would make an omnipotent being weep, confused as to how He had enough Omnipotent Powers™ to create a delicacy of such extremes. I really like cutting fresh strawberries.
  • Encoding, using a comparison between character sets as the example (lol just kidding)
  • Use cars as your example like normal but write the corresponding code explicitly and without explanation in Assembly psuedo-code somehow (you'll figure it out)
@tmccombs
Copy link

tmccombs commented Dec 9, 2014

Schrödinger's cat inherits from AliveCat and DeadCat as an exmple of multiple inheritance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment