javascript中继承不像c#中 class B:A
javascript 中继承通过设置
function super{
Id:"myid",
myMethod:funciton(){
alert("call myMethod!");
}
function sub{
//sub继承super
sub.prototype =new super();
var A= new sub();
此时 A就包含属性ID 和方法 myMethod()
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3