Back to Inheritance Builder
OOP Studio Ages 9-15

Inheritance Challenge

Create a parent class and at least one child class that adds a new method.

10-15 min Ages 9-15 OOP Challenge JavaScript
Code Editor

Create your own special object.

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

  use() {
    say("Using " + this.name + ".");
  }
}

class MagicTool extends Tool {
  glow() {
    say(this.name + " glows with extra power!");
  }
}

let wand = new MagicTool("Star Wand");
wand.use();
wand.glow();
Output

Program result

Robot ready to speak your strings

Type real JavaScript, then run it.