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];
}
}
}
{
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];
}
}
}
相关文章推荐
- javascript实现基于类的继承
- 基于JavaScript实现继承机制之构造函数方法对象冒充的使用详解
- JavaScript基于面向对象之继承机制
- 在JavaScript中,类的实现是基于原型继承机制的
- 探索javascript基于原型的继承方式
- javascript基于原型链的继承及call和apply函数用法分析
- 基于JavaScript实现继承机制之原型链(prototype chaining)的详解
- 详解JavaScript中基于原型prototype的继承特性
- JavaScript面向对象-基于函数伪造的方式实现继承
- 基于JavaScript实现继承机制之构造函数+原型链混合方式的使用详解
- 基于JavaScript实现继承机制之构造函数+原型链混合方式的使用详解
- javascript基于prototype实现类似OOP继承的方法
- 详解JavaScript基于面向对象之继承实例
- 一种基于ES5的JavaScript继承
- 原型模式和基于原型继承的JavaScript对象系统
- javascript中的继承(JS基于原型链的继承),以及JS中的call和apply函数
- JavaScript——面向对象以及基于类的继承
- JavaScript——面向对象以及基于类的继承
- javascript 高级——基于原型链的继承
- javascript 高级——基于原型链和伪装的继承