2012-10-23 16:45:31 -04:00
|
|
|
// Generated by CoffeeScript 1.4.0
|
2011-12-18 13:41:33 -05:00
|
|
|
var Animal, Horse, Snake, sam, tom,
|
2012-04-10 14:57:45 -04:00
|
|
|
__hasProp = {}.hasOwnProperty,
|
2012-05-14 14:45:20 -04:00
|
|
|
__extends = 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; };
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-12-23 15:41:42 -05:00
|
|
|
Animal = (function() {
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-11-21 12:38:27 -05:00
|
|
|
function Animal(name) {
|
|
|
|
this.name = name;
|
2010-10-24 21:50:34 -04:00
|
|
|
}
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-11-21 12:38:27 -05:00
|
|
|
Animal.prototype.move = function(meters) {
|
2011-06-08 19:38:12 -04:00
|
|
|
return alert(this.name + (" moved " + meters + "m."));
|
2010-11-21 12:38:27 -05:00
|
|
|
};
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-10-19 21:59:13 -04:00
|
|
|
return Animal;
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-12-23 15:41:42 -05:00
|
|
|
})();
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
Snake = (function(_super) {
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
__extends(Snake, _super);
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-10-19 21:59:13 -04:00
|
|
|
function Snake() {
|
2012-04-10 14:57:45 -04:00
|
|
|
return Snake.__super__.constructor.apply(this, arguments);
|
2010-10-24 21:50:34 -04:00
|
|
|
}
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-11-21 12:38:27 -05:00
|
|
|
Snake.prototype.move = function() {
|
|
|
|
alert("Slithering...");
|
|
|
|
return Snake.__super__.move.call(this, 5);
|
|
|
|
};
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-10-19 21:59:13 -04:00
|
|
|
return Snake;
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
})(Animal);
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
Horse = (function(_super) {
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
__extends(Horse, _super);
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-10-19 21:59:13 -04:00
|
|
|
function Horse() {
|
2012-04-10 14:57:45 -04:00
|
|
|
return Horse.__super__.constructor.apply(this, arguments);
|
2010-10-24 21:50:34 -04:00
|
|
|
}
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-11-21 12:38:27 -05:00
|
|
|
Horse.prototype.move = function() {
|
|
|
|
alert("Galloping...");
|
|
|
|
return Horse.__super__.move.call(this, 45);
|
|
|
|
};
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-10-19 21:59:13 -04:00
|
|
|
return Horse;
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2011-12-18 13:41:33 -05:00
|
|
|
})(Animal);
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-07-29 00:51:35 -04:00
|
|
|
sam = new Snake("Sammy the Python");
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-07-29 00:51:35 -04:00
|
|
|
tom = new Horse("Tommy the Palomino");
|
2011-09-20 23:42:19 -04:00
|
|
|
|
2010-07-29 00:51:35 -04:00
|
|
|
sam.move();
|
2011-09-20 23:42:19 -04:00
|
|
|
|
|
|
|
tom.move();
|