Simple Inheritance Module
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
.gitignore
LICENSE
README.md
bower.json
gulpfile.js
inherit.js
package.json

README.md

inheritjs

Simple Inheritance Module

Usage

  
  function Parent() {}
  Parent.prototype.parentMethod = function () { console.log('parent method!'); };
  
  function Child () {
    Parent.prototype.constructor.call(this);
  }
  // setup inheritance before adding child prototype methods
  inherit(Parent, Child);
  
  Child.prototype.childMethod = function () { console.log('child method!'); };
  
  var child = new Child();
  child.childMethod();  // child method!
  child.parentMethod(); // parent method!