javascript学习五script typetext/javascript//使用混合方式实现对象的继承function parent(hello){t
javascript学习五
<script type="text/javascript">//使用混合方式实现对象的继承function parent(hello){this.hello=hello;}parent.prototype.sayHello=function(){alert(this.hello);}function child(hello,word){//实现属性的继承parent.call(this,hello);this.word=word;}//实现方法的继承child.prototype=new parent();child.prototype.sayWord=function(){alert(this.word);}var p=new parent("hello");var c=new child("word","123");p.sayHello();c.sayHello();c.sayWord();</script>?学到这里,javascript的核心应该已经学完了,可是自己感觉没什么进步,不知道大家是怎么在学习啊,希望大家能指教指教小弟。
?
