JSFiddle - React, Tailwind, and code Playground

JavaScript

function Class(init, parent, methods) {
    var prototype;
    if (!parent) {
        prototype = {};
    } else {
        var ParentInit = function () {};
        ParentInit.prototype = parent.prototype;
        prototype = new ParentInit;
    }

    for(var name in methods) {
        prototype[name] = methods[name];
    }

    if (!init) { init = function () {}; }
    init.prototype = prototype;
    return init;
}

var C1 = Class(null, null, {
    bark: function () { console.log('bark bark'); }
});
var C2 = Class(function (barking) {
    this.barking = barking;
}, null, {
    bark: function () { console.log(this.barking); }
});
var C3 = Class(function () {
    this.barking = "meow";
}, C2);
var C4 = Class(null, C1, {
    bark: function () {
        console.group('I say');
        C1.prototype.bark.call(this);
        console.groupEnd();
    }
});

new C1().bark();
new C2("Baaawk").bark();
new C3().bark();
new C4().bark()