Skip to content

Instantly share code, notes, and snippets.

@RStankov
Created August 10, 2009 10:41
Show Gist options
  • Save RStankov/165128 to your computer and use it in GitHub Desktop.
Save RStankov/165128 to your computer and use it in GitHub Desktop.
/*
var Person = Class.create(function(){
initialize: function(firstName, lastName){
this.firstName = firstName;
this.lastName = lastName;
},
toString: function(){
return this.firstName + ' ' + this.lastName;
}
});
var pe6o = Class.initialize(Person, ['firstName', 'lastName']);
*/
Class.initialize = function(klass, args){
var ghost = function(){};
ghost.prototype = klass.prototype;
var object = new ghost();
object.initialize.apply(this, args);
return object;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment