Java for Humans {Class Inheritance}

Lincoln W Daniel
HackerNoon.com

--

View Table of Contents | Download Supporting Code | Subscribe to ModernNerd Youtube Channel for Coding Videos | By Lincoln W Daniel

Inheritance is one of the most powerful concepts in all of programming. Without it, it’d be tough to do many of the cool things we do. One of my favorite games as a kid was Conquer 2.0. The game was fun because you could be anything, and at the same time, each thing was like the others. Yes different and the same at the same time. Isn’t that wonderful? Let me explain.

In Conquer, you can be an Archer, Monk, Ninja, Warrior, or one of two types of a Taoist. The great thing about the game is that no one class is much different from another and if you want to be another class, it isn’t too hard to understand how it works. This is possible because every class is built upon a single class, and, consequently, they all share similar attributes and functionalities. There is no Human class in Conquer, but it is clear that all of the classes mentioned above are humans with distinctive super powers.

An Archer can fly and shoot fire arrows, a Ninja can run fast and attack with stars, a Warrior can wield a sword and a sword, and a Taoist can perform magical acts and heal others. While those classes appear different, they are more alike than you may think. Every class extends the capability of a Human. A Human can jump, attack, and heal itself. Further, every human has a name, health, attack power, and experience. All of that adds up to two attributes and five functions…

--

--

Lincoln W Daniel
HackerNoon.com

Chief Bull @ BullAcademy.org ® Elevating writers @ ManyStories.com. Author @JavaForHumans Ex: Editor in Chief MarkGrowth (acq.), Engineer @Medium @GoPuff