You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
476 B
JavaScript
20 lines
476 B
JavaScript
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;
|
|
}
|