Skip to content

Instantly share code, notes, and snippets.

@andrIvash
Created September 17, 2015 16:03
Show Gist options
  • Save andrIvash/61c806b41af8a1475d9e to your computer and use it in GitHub Desktop.
Save andrIvash/61c806b41af8a1475d9e to your computer and use it in GitHub Desktop.
inheritance in javascript
//шаблон наследования в javascript
//C - child, P - parent , F - empty function
//uber - original ancestor
// C.prototype.constructor = C - a pointer to the constructor
function inherit(C, P) {
var F = function () {};
F.prototype = P.prototype;
C.prototype = new F();
C.uber = P.prototype;
C.prototype.constructor = C;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment