function A(x)
{
this.x = x;
}
alert(A.prototype);
alert(A.prototype.constructor);
function A(x)
{
A.prototype.x = x;
}
var obj = new A(10);
alert(obj.x);
alert(obj.constructor);
function A(x)
{
A.prototype.x = x;
}
var objA = new A(10);
objA.constructor = function(x){ alert("重写obj的constructor属性");this.x = 20 };
objA.constructor();
alert(objA.x);
var objB = new A(10);
alert(objB.x);
function A(x)
{
A.prototype.x = x;
}
function B(x,y)
{
B.prototype.y = y;
A.call(this,x);
}
function A(x)
{
A.prototype.x = x;
A.prototype.ShowA = function(){ alert("A的Show方法!"); };
}
function B(x,y)
{
B.prototype.y = y;
A.call(this,x);
B.prototype.ShowB = function(){ alert("B的Show方法!"); };
}
B.prototype = new A();
B.prototype.constructor = B;
var obj = new B(10,5);
alert(obj.x);
alert(obj.y);
obj.ShowA();
obj.ShowB();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有