javascript prototype inheritance
by kwon
JavaScript
function Foo() {
parentThis = this;
this.bar = function() {
console.log("bar");
return "bar";
}
}
function Hello() {
this.bye = function() {
console.log("bye");
}
}
Hello.prototype.world = function() {
console.log(this);
console.log("hello "+this.bar())
}
//jQuery.extend(Foo, Hello);
//Foo.extend(Hello);
//Foo.prototype = new Hello();
Foo.prototype = new Hello;
//Foo.inherits(Hello);
var f = new Foo();
f.bar();
Foo.bar = function() {
console.log("foo");
}
Foo.bar();
f.world();
f.bye();