Back to Inheritance
Advanced Objects

Inheritance Builder: Creature Academy

Build two child classes that share a parent ability and each add a unique power.

20-25 minOOP BuilderJavaScript
Build two children from one parent.

Creature already knows fly(). Dragon and Unicorn inherit that shared method, then each adds one special power.

Shared: both can fly()Dragon adds: breatheFire()Unicorn adds: heal()
1. Build

Add Dragon and Unicorn to the class family.

2. Test inherited behavior

Press fly() once on each creature.

3. Test special behavior

Make Dragon breathe fire and Unicorn heal.

Build the Family
C
Creaturefly()shared parent method

Add both child classes

NEXT STEPAdd both child classes.
See generated JavaScript
Creature Training Yard

Build a child to begin.

No child classes built yet.

Build 2 childrenUse shared fly()Use both special powers

Children inherit fly() without rewriting it.