Skip to content

Instantly share code, notes, and snippets.

@JustinTulloss
Created February 15, 2010 10:23
Show Gist options
  • Select an option

  • Save JustinTulloss/304540 to your computer and use it in GitHub Desktop.

Select an option

Save JustinTulloss/304540 to your computer and use it in GitHub Desktop.
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