Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barakargaman/5489019 to your computer and use it in GitHub Desktop.
Save barakargaman/5489019 to your computer and use it in GitHub Desktop.
function A() {
this.aParam = 'a sababa',
this.aFunction = function() { return this.aParam; }
};
function B() {
this.bParam = 'b sababa',
this.bFunction = function() { return this.bParam; }
};
function C() {
this.cParam = 'c sababa',
this.cFunction = function() { return this.cParam; }
};
function D() {
this.dParam = 'd sababa',
this.dFunction = function() { return this.dParam; }
};
B.prototype = new A();
C.prototype = new B();
D.prototype = new C();
var a = new A();
var b = new B();
var c = new C();
var d = new D();
// ----------------------
console.log(d.dParam) // d sababa
console.log(d.cParam) // c sababa
console.log(d.aFunction()) // a sababa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment