Inheritance in Extjs

Posted on Updated on

Like other Object-Oriented(OO) languages, Ext JS also supports Inheritance.
Ext JS has extend keyword, which is used to inherit a class. We shall see it in below example.

Let’s create Employee and Manager class. Manager class will inherit Employee class using extend keyword.

We have created Employee class with two variables name and age in config, so getter-setter methods will be generated automatically for these two variables.

Manager class extends Employee class, so functions “display” and “status” will be inherited and will be accessible through it. Manager class also has “status” function, which is an example of method overriding.

Create object of Employee class and invoke display and status function and run the application.

Below outputs will be displayed on console:

Now create object of Manager class and invoke inherited method “display” and overridden method “status“.

Below outputs will be displayed on console after running the application:

One thought on “Inheritance in Extjs

    Mike said:
    February 28, 2016 at 7:40 pm

    Very good Article.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.