Ext.onready (function () {//Subclass Integrated Parent class Ext.define ("person", {config:{name: "", Age:0,sex: ""},say:function () {Ext.Msg.alert ("header Information", "User prompt Information");},constructor:function (config) {var me = this; Me.initconfig (config);}}); Ext.define ("Student", {extend: "person", //inheritance Relationship config:{},run:function () {Ext.Msg.alert ("Subclass header Information", "Subclass user hint Information")}, Constructor:function (config) {var me = this; Me.initconfig (config);}}) var stu1 = ext.create ("person", {name: "Hubby", Age:22,sex: "Female"}), Window.alert (Stu1.getname ()) Stu1.say () var stu2 = Ext.create ("Student", {name: "Student", Age:23,sex: "Male"}), Window.alert (stu2.age) Stu2.say () //Gets the Say method of the parent class alert ("--- ---------"); Stu2.run ()//Get a subclass of the Run Method});
Extjs--08--ext inheritance relationships for custom classes