Skip to content

Instantly share code, notes, and snippets.

@Neppord
Forked from chrivers/class example
Created March 2, 2011 15:49
Show Gist options
  • Save Neppord/851134 to your computer and use it in GitHub Desktop.
Save Neppord/851134 to your computer and use it in GitHub Desktop.
var FooClass = function()
{
x = function() { /* Class constructor */ };
x.prototype.foo = "bar";
x.prototype.__init__ = function()
{
this.something = "other";
};
x.prototype.__call__ = function() {
return 42;
};
q = new x();
q.__call__ = function()
{
obj = new x();
obj.__init__(arguments);
// y = new Object();
// for (var key in x.prototype)
// {
// y[key] = x.prototype[key];
// }
// return y;
};
return q;
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment