Skip to content

mparke/inherit_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!
  

About

Simple Inheritance Module

Resources

License

Stars

Watchers

Forks

Packages

No packages published