I'm using Ext4...
How to check whether one class is inherited of another class?
for example:
Ext.define("A", {});
Ext.define("B", { extend: "A" });
Ext.define("C", { extend: "B" });
var a = Ext.create("A");
var c = Ext.create("C");
I need something like this: c instanceof a
???
Thanks
Python issubclass() is built-in function used to check if a class is a subclass of another class or not. This function returns True if the given class is the subclass of given class else it returns False. Parameters: Object: class to be checked.
Two built-in functions isinstance() and issubclass() are used to check inheritances. The function isinstance() returns True if the object is an instance of the class or other classes derived from it. Each and every class in Python inherits from the base class object .
Inheritance enables you to create new classes that reuse, extend, and modify the behavior defined in other classes. The class whose members are inherited is called the base class, and the class that inherits those members is called the derived class. A derived class can have only one direct base class.
(Based on @troelskn 's comment)
http://jsfiddle.net/miriam/ugQHB/
c instanceof A
returns true.
You can use isXtype method. See docs here: Ext.AbstractComponent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With