Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created August 28, 2015 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/8c465653766e1109568b to your computer and use it in GitHub Desktop.
Save chuck0523/8c465653766e1109568b to your computer and use it in GitHub Desktop.
// Generated by CoffeeScript 1.9.3
(function() {
var AdminUser, SuperUser, User, bob, judy, log,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
log = function(x) {
return console.log(x);
};
User = (function() {
function User(name) {
this.name = name;
}
User.prototype.hello = function() {
return log("hello, " + this.name);
};
return User;
})();
AdminUser = (function(superClass) {
extend(AdminUser, superClass);
function AdminUser() {
return AdminUser.__super__.constructor.apply(this, arguments);
}
return AdminUser;
})(User);
bob = new AdminUser("Bob");
log(bob.name);
bob.hello();
SuperUser = (function(superClass) {
extend(SuperUser, superClass);
function SuperUser() {
return SuperUser.__super__.constructor.apply(this, arguments);
}
SuperUser.prototype.hello = function() {
log("sudo ");
return SuperUser.__super__.hello.call(this);
};
return SuperUser;
})(User);
judy = new SuperUser("judy");
judy.hello();
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment