Add core inheritance functionality
commit
bca504ac76
@ -0,0 +1,19 @@
|
|||||||
|
Function.prototype.inheritsFrom = function(parentClassOrObject)
|
||||||
|
{
|
||||||
|
if ( parentClassOrObject.constructor == Function )
|
||||||
|
{
|
||||||
|
//Normal Inheritance
|
||||||
|
this.prototype = new parentClassOrObject;
|
||||||
|
this.prototype.constructor = this;
|
||||||
|
this.prototype.parent = parentClassOrObject.prototype;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Pure Virtual Inheritance
|
||||||
|
this.prototype = parentClassOrObject;
|
||||||
|
this.prototype.constructor = this;
|
||||||
|
this.prototype.parent = parentClassOrObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
Loading…
Reference in New Issue