亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

面向?qū)ο罄^承實例(a如何繼承b問題)(自寫)

 更新時間:2013年07月01日 17:08:42   作者:  
經(jīng)常會看到a如何繼承b的問題;決定寫一下,其實繼承就是繼承父級的屬性和方法,感興趣的朋友可以參考下哈,希望對大家有所幫助
復制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>面向?qū)ο罄^承實例</title>
<script type="text/javascript">
window.onload = function(){
function parent(age,name){
this.age = age;
this.name = name;
}
parent.prototype.show = function(){
alert('父級方法');
}
function child(age,name,job){
parent.apply(this,arguments);
this.job = job;
}
(function(){
for(var i in parent.prototype){
child.prototype[i]=parent.prototype[i]
}
})();

var b = new parent(14,'俠客行');
var a = new child(15,'狼俠','俠客');
a.show();

}
</script>
</head>
<body>
<h1>面向?qū)ο罄^承實例</h1>
<p>經(jīng)??吹矫嬖囶}有關繼承問題 a如何繼承b 決定寫一下,其實繼承就是繼承父級的屬性和方法</p>
</body>
</html>

相關文章

最新評論