-
-
Save hackervera/503187 to your computer and use it in GitHub Desktop.
Hipster javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./MooTools').apply(GLOBAL); | |
var sys = require('sys'); | |
var Human = new Class({ | |
eat: function() { this.energy++; }, | |
drink: function(target){ target.open(); } | |
}); | |
var Beer = new Class({ | |
initialize: function(brewer, age){ | |
this.brewer = brewer; | |
this.age = age; | |
} | |
}); | |
var Can = new Class({ | |
open: function(){ console.log("You break the seal with the tab, gotta love that sound"); }, | |
}); | |
var PBR = new Class({ | |
Extends: Beer, | |
Implements: Can | |
}); | |
tyler = new Human(); | |
tyler.drink(new PBR()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment