JS 继承实例分析
function P(name){
this.name=name;
this.p1=function(){
alert('Parent Constructor');
}
return this;
}
function C(name,id){
//this.method=P;
//this.method(name); //1st method
//P.call(this,name); //2nd method
P.apply(this,new Array(name));//3rd method
this.id=id;
this.dis=function(){
alert(this.name);
}
}
function dis(){
alert(this.name);
}
function t(){
var cc=new C('N','Id');
cc.dis();
cc.p1();
}
Javascript 对象的解释
所有的构造器都是对象,而并非所有的对象都是构造器.每个构造器都有一个用来实现原型继承、共享属性的Prototype属性。对象通过new表达式创建;比如
js继承 Base类的源码解析
//timestamp:Tue,01May200719:13:00/*base2.js-copyright2007,DeanEdwardshttp://www.opensource.org/licenses/mit-license*///Youknow,writingajavascriptlibraryisawfullytimeconsuming.////////////////////BEGIN
[推荐]javascript 面向对象技术基础教程
结果呢,看了大半天,有了一个大概的了解,细细一回味,好像什么都没懂...这篇文章是参考javascript-thedefinitiveguide,5thedition第7,8,9章而写成的,我也会尽量按