Back to Inheritance
OOP Studio Ages 9-15

Inheritance Builder

Students create a parent class, then build two child classes with different powers.

20-25 min Ages 9-15 OOP Builder JavaScript
Code Editor

Build two special character types.

Example code
class Creature {
  constructor(name) {
    this.name = name;
  }

  move() {
    say(this.name + " moves across the map.");
  }
}

class Dragon extends Creature {
  breatheFire() {
    say(this.name + " breathes a tiny practice flame.");
  }
}

class Unicorn extends Creature {
  heal() {
    say(this.name + " shares healing light.");
  }
}

let dragon = new Dragon("Ember");
let unicorn = new Unicorn("Luna");

dragon.move();
dragon.breatheFire();
unicorn.move();
unicorn.heal();
Output

Program result

Robot ready to speak your strings

Type real JavaScript, then run it.