<script>
/*
* js实现继承的练习
prototype原型继承
*/
function Parent(){
}
Parent.test=new function(){
alert("我是父类方法");
}
function Child(){
}
Child.prototype=new Parent();
var c=new Child();
alert(c.test());
</script>
/*
* js实现继承的练习
prototype原型继承
*/
function Parent(){
}
Parent.test=new function(){
alert("我是父类方法");
}
function Child(){
}
Child.prototype=new Parent();
var c=new Child();
alert(c.test());
</script>