您的位置:首页 > Web前端 > JavaScript

Javascript基于类的继承

2007-07-30 12:02 309 查看
function parent()
{
var id=1;
var username="roboth";
this.getID=function(){return id;}
this.getUserName=function(){return username;}
}

function child()
{}

var child1=new child();
createInheritance(new parent(),child1);

function createInheritance(parent,child)
{
var pro;
for (pro in parnet)
{
if(!child[pro])
{
child[pro]=parent[pro];
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
-->
新的分享
章节导航