Skip to content

Instantly share code, notes, and snippets.

@videlais
Created May 2, 2014 16:42
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 videlais/acab326117db91238a4c to your computer and use it in GitHub Desktop.
Save videlais/acab326117db91238a4c to your computer and use it in GitHub Desktop.
JS Lesson 8
function A() {
this.value = 1;
}
A.prototype.getValue = function() {
return this.value;
};
A.prototype = Object.create(A.prototype);
A.prototype.constructor = A;
function B() {
A.call(this);
this.secondValue = 2;
}
B.prototype.getSecondValue = function() {
return this.secondValue;
};
B.prototype = Object.create(B.prototype);
B.prototype.constructor = B;
function C() {
A.call(this);
B.call(this);
}
C.prototype = {
getValue: function() {
return A.prototype.getValue.call(this);
},
getSecondValue: function() {
return B.prototype.getSecondValue.call(this);
}
};
C.prototype = Object.create(C.prototype);
C.prototype.constructor = C;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment