Created
February 15, 2010 10:23
-
-
Save JustinTulloss/304540 to your computer and use it in GitHub Desktop.
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
| var Animal = new Cobra.Class({ | |
| __init__: function(self) { | |
| self.breathes = true; | |
| } | |
| }); | |
| var Feline = new Cobra.Class({ | |
| __extends__: Animal, | |
| __init__: function(self) { | |
| Cobra.Class.ancestor(Feline, '__init__', self); | |
| self.claws = true; | |
| self.furry = true; | |
| }, | |
| says: function(self) { | |
| console.log ('GRRRRR'); | |
| } | |
| }); | |
| var Cat = new Cobra.Class({ | |
| __extends__: Feline, | |
| __init__: function(self) { | |
| Cobra.Class.ancestor(self, '__init__', self); | |
| self.weight = 'very little'; | |
| }, | |
| says: function(self) { | |
| console.log('MEOW'); | |
| } | |
| }); | |
| var Tiger = new Cobra.Class({ | |
| __extends__: Feline, | |
| __init__: function(self) { | |
| Cobra.Class.ancestor(Tiger, '__init__', self); | |
| self.weight = 'quite a bit'; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment