<script language="javascript" type="text/javascript">
var class1 = function () {
this.p = "class1:";
this.method1 = function (arg) {
this.sex = "1";
alert(this.p + arg + this.sex);
}
this.method2 = function () {
this.method1.sex = "2";
}
}
var class2 = function () {
this.p = "class2:";
this.method1 = function (arg) {
this.sex = "2"; //Overrided
alert(this.p + arg);
}
this.method2 = function () {
}
this.method3 = function () {
}
}
var c1 = new class1();
var c2 = new class2();
c1.method1("good!");
c1.method2();
c2.method3 = c1.method1;
c2.method3("good!");
</script>