How to do javascript subclassing

In : linux, mysql, Uncategorized, Posted by 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 :
No comments for this entry yet...