Classical Inheritance implement in javascript

dq9

New Member
All. I am newbie for the javascript , I am trying to implement inheritance in javascript.here is what I have done so far . please review it .\[code\]var TField=function(jData){ this.id=jData.id; this.name=jData.name; this.attributes=jData.attributes; this.render=function(){ alert('TField render.'); };};var TChildField=function(jData){ var t= new TField(jData); t.render=function(){ alert('TChildField render.'); } return t;}var tobj={id:"1",name:"test",attribute:{}};var c= new TChildField(tobj);alert(c.id);alert(c.name);\[/code\]What I am trying to do is inheritance the \[code\]id\[/code\] and \[code\]name\[/code\] from the \[code\]TField\[/code\]. and override the \[code\]render\[/code\] function of the \[code\]TField\[/code\]. I want to know if it is the stardard way to implement of inheritance in javascript. thanks.
 
Back
Top