javascript类的 功能比较弱,还不支持此功能
<script>
function AA(a,b){
this.a=a;
this.b=b;
this.c=this.a+this.b;
}
x=new AA('100','a')
alert(x.b)
alert(x.c)
x.b="xxxxxxx"
alert(x.c)x=new AA()
x.a="100"
x.b='aaa'
alert(x.a)
alert(x.b)
alert(x.c)
</script>
<script>
function AA(a,b){
this.a=a;
this.b=b;
this.c=this.a+this.b;
}
x=new AA('100','a')
alert(x.b)
alert(x.c)
x.b="xxxxxxx"
alert(x.c)x=new AA()
x.a="100"
x.b='aaa'
alert(x.a)
alert(x.b)
alert(x.c)
</script>
obj.test2 = 'atttest2value';
for(var i in obj){
alert("obj." + i + " = " + obj[i]);
}