How to do javascript subclassing

In : Uncategorized, linux, mysql, Posted by admin on Mar.03, 2009

http://www.golimojo.com/etc/js-subclass.html


function subclass(constructor, superConstructor)
{
function surrogateConstructor()
{
}

surrogateConstructor.prototype = superConstructor.prototype;

var prototypeObject = new surrogateConstructor();
prototypeObject.constructor = constructor;

constructor.prototype = prototypeObject;
}

Tags :

 
close Reblog this comment
blog comments powered by Disqus