Skip to content

Instantly share code, notes, and snippets.

@phstc
Created June 27, 2012 21:31
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 phstc/3006997 to your computer and use it in GitHub Desktop.
Save phstc/3006997 to your computer and use it in GitHub Desktop.
class Commenter
constructor: (@author) ->
write: (message) ->
console.log "#{@author}: #{message}"
commenter = new Commenter 'Pablo'
commenter.write 'Hello World'
(function() {
var Commenter, commenter;
Commenter = (function() {
function Commenter(author) {
this.author = author;
}
Commenter.prototype.write = function(message) {
return console.log("" + this.author + ": " + message);
};
return Commenter;
})();
commenter = new Commenter('Pablo');
commenter.write('Hello World');
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment