Created
April 8, 2012 02:11
-
-
Save Radagaisus/2333742 to your computer and use it in GitHub Desktop.
Inheriting like a Boss
This file contains hidden or 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
| class Zero | |
| @create: -> | |
| class OrpheusInner extends @ | |
| attributes: [] | |
| attr: (x) -> @attributes.push x | |
| return new OrpheusInner() | |
| class One extends Zero | |
| constructor: -> | |
| @attr 'bloob' | |
| class Two extends Zero | |
| constructor: -> | |
| @attr 'zoob' | |
| o = One.create() | |
| t = Two.create() | |
| console.log o.attributes | |
| console.log t.attributes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment