classAnimalconstructor: (@name, @age) ->say_hello: (something) ->console.log"Hello, #{something}"classHumanextendsAnimalwalk: ->console.log"I can walk with my foots!"eddie = newHuman("eddie",18)eddie.say_hello"CoffeeScript"eddie.walk()
varAnimal,Human,eddie;var__hasProp=Object.prototype.hasOwnProperty,__extends=function(child,parent){for(varkeyinparent){if(__hasProp.call(parent,key))child[key]=parent[key];}functionctor(){this.constructor=child;}ctor.prototype=parent.prototype;child.prototype=newctor;child.__super__=parent.prototype;returnchild;};Animal=(function(){functionAnimal(name,age){this.name=name;this.age=age;}Animal.prototype.say_hello=function(something){returnconsole.log("Hello, "+something);};returnAnimal;})();Human=(function(){__extends(Human,Animal);functionHuman(){Human.__super__.constructor.apply(this,arguments);}Human.prototype.walk=function(){returnconsole.log("I can walk with my foots!");};returnHuman;})();eddie=newHuman("eddie",18);eddie.say_hello("CoffeeScript");eddie.walk();