diff --git a/core.js b/core.js index 840003b..7d3ab30 100644 --- a/core.js +++ b/core.js @@ -1,18 +1,19 @@ -Function.prototype.inheritsFrom = function(parentClassOrObject) +/* Thanks to http://phrogz.net/js/classes/OOPinJS2.html */ +Function.prototype.inheritsFrom = function(parentObject) { - if ( parentClassOrObject.constructor == Function ) + if(parentClassOrObject.constructor == Function) { - //Normal Inheritance - this.prototype = new parentClassOrObject; + /* Normal Inheritance */ + this.prototype = new parentObject; this.prototype.constructor = this; - this.prototype.parent = parentClassOrObject.prototype; + this.prototype.parent = parentObject.prototype; } else { - //Pure Virtual Inheritance - this.prototype = parentClassOrObject; + /* Pure Virtual Inheritance */ + this.prototype = parentObject; this.prototype.constructor = this; - this.prototype.parent = parentClassOrObject; + this.prototype.parent = parentObject; } return this;