JSFiddle - React, Tailwind, and code Playground

by Alexandre Simoes

JavaScript

function Command() {

    this.gatherData = function () {
        console.log("Not implemented");
    }

    this.generateReport = function () {
        console.log("generateReport implemented in Command");
        this.gatherData(); //< ----this should call the derived class version.Is it possible ?
    }
}

//In SaveCommand.js
function SaveCommand() {

    this.gatherData = function () {
        console.log("here it is implemented");
    }

    this.testMe = function () {
        this.generateReport();
    }
}

SaveCommand.prototype = new Command();

var test = new SaveCommand();
test.testMe();