摘要:        
在JavaScript中,继承可以用四种方式实现, 1、对象冒充 感觉这种方式利用了js中类和函数的模糊性,同是function关键字申明方法,既可以说他是函数,也可以说他是类,js太灵活了,下面的例子说明下: function ClassA(sColor){ this.color=sColor; this.sayColor=function(){ alert(this.color); } } function ClassB(sColor){ this.newMethod=ClassA;//把ClassA方法赋给newMethod. this.newMethod();//调用newMethod    阅读全文
            
                posted @ 2008-12-27 19:12
corange
阅读(147)
评论(0)
推荐(0)
            
         
                    
                 浙公网安备 33010602011771号
浙公网安备 33010602011771号