aboutsummaryrefslogtreecommitdiff
path: root/samples/JavaScript/classes.js
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-07-23 15:52:49 -0500
committerJoshua Peek <josh@joshpeek.com>2012-07-23 15:52:49 -0500
commit7b6caa0f6c7603aabb5e6ed657e24aaddbeafc78 (patch)
treeec0522eae75bb04ae73d28ae3f599682a2bfdaeb /samples/JavaScript/classes.js
parent314f0e485227915931db361be14d308a210bedea (diff)
Rename samples subdirectories
Diffstat (limited to 'samples/JavaScript/classes.js')
-rw-r--r--samples/JavaScript/classes.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/samples/JavaScript/classes.js b/samples/JavaScript/classes.js
new file mode 100644
index 0000000..888e02b
--- /dev/null
+++ b/samples/JavaScript/classes.js
@@ -0,0 +1,69 @@
+// Generated by CoffeeScript 1.2.1
+(function() {
+ var Animal, Horse, Snake, sam, tom,
+ __hasProp = {}.hasOwnProperty,
+ __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; };
+
+ Animal = (function() {
+
+ Animal.name = 'Animal';
+
+ function Animal(name) {
+ this.name = name;
+ }
+
+ Animal.prototype.move = function(meters) {
+ return alert(this.name + " moved " + meters + "m.");
+ };
+
+ return Animal;
+
+ })();
+
+ Snake = (function(_super) {
+
+ __extends(Snake, _super);
+
+ Snake.name = 'Snake';
+
+ function Snake() {
+ return Snake.__super__.constructor.apply(this, arguments);
+ }
+
+ Snake.prototype.move = function() {
+ alert("Slithering...");
+ return Snake.__super__.move.call(this, 5);
+ };
+
+ return Snake;
+
+ })(Animal);
+
+ Horse = (function(_super) {
+
+ __extends(Horse, _super);
+
+ Horse.name = 'Horse';
+
+ function Horse() {
+ return Horse.__super__.constructor.apply(this, arguments);
+ }
+
+ Horse.prototype.move = function() {
+ alert("Galloping...");
+ return Horse.__super__.move.call(this, 45);
+ };
+
+ return Horse;
+
+ })(Animal);
+
+ sam = new Snake("Sammy the Python");
+
+ tom = new Horse("Tommy the Palomino");
+
+ sam.move();
+
+ tom.move();
+
+}).call(this);