欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

批量實(shí)現(xiàn)面向?qū)ο蟮膶?shí)例代碼

 更新時(shí)間:2013年07月01日 17:05:03   作者:  
本文為大家詳細(xì)介紹下面向?qū)ο蟮睦^承以及如何實(shí)現(xiàn)批量實(shí)現(xiàn)面向?qū)ο?,感興趣的可以參考下哈,希望對(duì)大家有所幫助
復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>批量實(shí)現(xiàn)面向?qū)ο蟮膶?shí)例</title>
<script type="text/javascript">
window.onload = function(){
function Person(name,age){
this.name = name;
this.age = age;
}
Person.prototype.showName = function(){
alert(this.name);
};
function extend(parent,child,method){
function a(){
parent.apply(this,arguments);
child.apply(this,arguments);
};
for(var i in parent.prototype){
a.prototype[i]=parent.prototype[i];
}
for(var i in method){
a.prototype[i] = method[i];
}
return a;
};//參數(shù)為父級(jí)構(gòu)造函數(shù),子級(jí)構(gòu)造函數(shù),子級(jí)方法
var int = extend(Person,function(name,age,job){
this.job = job;
},
{
showjob:function(){
alert(this.job);
}
}
);
var oc=new int('俠客',24,'工作');
oc.showjob();
}
</script>
</head>
<body>
<h1>面向?qū)ο罄^承實(shí)例</h1>
<p>開始展示批量實(shí)現(xiàn)面向?qū)ο蟮膶?shí)例</p>
</body>
</html>

相關(guān)文章

最新評(píng)論