请问这样的话子类不是根据参数列表的不同重载了a方法吗??
但是为什么输出是Child Method count undefined 呢??
不是应该根据参数列表的不同调用了从父类继承的a方法,输出Parent Method count吗??
请指教!~~
function Parent() {
this.a=function(){
alert("Parent Method count");
}}
Children.prototype = new Parent();
function Children() {
this.a = function(cc) {
alert("Child Method count" + cc);
}
}
var c = new Children();
c.a();
------解决方案--------------------
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html> <head> <title>new document</title> <script type="text/javascript"> function Parent() { this
------解决方案--------------------
javascript中只会进行方法的拷贝,而不会进行引用!