Skip to content

Instantly share code, notes, and snippets.

@tnhu
Created March 24, 2010 00:25
Show Gist options
  • Save tnhu/341846 to your computer and use it in GitHub Desktop.
Save tnhu/341846 to your computer and use it in GitHub Desktop.
var A = B = C = null;
jsface.def({
cls: 'A',
as: function(){
return {
A: function(){
console.log('A > constructor');
},
hello: function(){
console.log('A > hello');
}
}
}});
jsface.def({
cls: 'B',
under: A,
as: function(){
return {
B: function(){
console.log('B > constructor');
A.call(this);
},
hello: function(){
console.log('B > hello');
A.prototype.hello.call(this);
}
}
}});
jsface.def({
cls: 'C',
under: B,
as: function(){
return {
C: function(){
console.log('C > constructor');
B.call(this);
},
hello: function(){
console.log('C > hello');
B.prototype.hello.call(this);
}
}
}});
new A().hello();
console.log('------');
new B().hello();
console.log('------');
new C().hello();
* * *
OUTPUT:
A > constructor
A > hello
------
B > constructor
A > constructor
B > hello
A > hello
------
C > constructor
B > constructor
A > constructor
C > hello
B > hello
A > hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment