function Class1(){ this.name = "class1"; this.showNam = function() { alert(this.name); }}function Class2(){ this.name = "class2";}var c1 = new Class1();var c2 = new Class2();c1.showNam.call(c2);上面写法是使用call方法实现的把c1的方法放到c2上执行,那么和下面这种写法的区别在哪里呢?var c3 = new Class1();
添加回答
举报
0/150
提交
取消