Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Forked from StanAngeloff/gist:316975
Created February 27, 2010 21:39
Show Gist options
  • Save tim-smart/316980 to your computer and use it in GitHub Desktop.
Save tim-smart/316980 to your computer and use it in GitHub Desktop.
var A = function() {};
A.prototype.over = function() {};
var B = function() {
this.where_am_i = 'at work';
A.call(this);
};
var _fn = function() {};
_fn.prototype = B.prototype;
B.prototype = new _fn();
B.prototype.sayWhereYouAre = function sayWereYouAre() {
alert('I am ' + this.where_am_i);
};
B.prototype.over = function over() {
A.prototype.over.call(this);
};
prototype A
over: ->
super()
prototype B extends A
constructor: ->
@where_am_i: 'at work'
super()
sayWhereYouAre: ->
alert 'I am ' + @where_am_i
over: ->
super()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment