What is the difference between Ext.extend and Ext.override? In java, you extend a class and you override its methods. But looking at syntax, it seems in extjs, you can both extend a class and override a class
Asked
Active
Viewed 1.2k times
2 Answers
36
Ext.extend
gives you a new class basing on existing one.
Ext.override
modifies existing class without creating a new one.
It's not something specific to ExtJS. It's how JavaScript's prototype-based object model works. It's quite different from what you're used to in Java. ExtJS just adds these two utility methods to make it a bit easier to use.

Mchl
- 61,444
- 9
- 118
- 120
-
1So Ext.override has no equivalent in java? – Victor Feb 04 '11 at 19:21
-
1this is not entirely true, you can override methods any existing class when you create an instance of it as an anonymous inner class. `ArrayList al = new ArrayList() { public void add(Object o) { // override }` for example. This is the same thing in spirit since it is still an `ArrayList` as far as any client is concerned. – Nov 11 '14 at 15:54
-
@JarrodRoberson: Interesting! I've very little experience with Java, so I didn't know this. Thanks! – Mchl Nov 12 '14 at 08:35
1
Mchl has already answered to your query.
I just want to add, for adding features to ExtJs involves these four ways:
- Extend
- Override
- Plugin
- Sequence/Intercept
Please refer to this link for detail information:
http://www.slideshare.net/VinylFox/four-ways-to-add-features-to-ext-js

Kunal Goel
- 3,357
- 1
- 14
- 20
-
1In ExtJS 5 we have `Ext.Function.interceptBefore` instead Intercept and `Ext.Function.interceptAfter` instead Sequence. – rzymek Aug 27 '14 at 17:10
-
1Thanks for adding up the information, I didn't looked @ExtJs 5 that time. – Kunal Goel Nov 13 '14 at 12:24