javascript - How to check whether one class is inhereted of another class? - Stack Overflow

I'm using Ext4...How to check whether one class is inherited of another class?for example:Ext.defi

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

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

Share Improve this question edited Aug 17, 2011 at 7:32 Reporter 3,9365 gold badges35 silver badges49 bronze badges asked Aug 17, 2011 at 7:25 Eugene PetrovEugene Petrov 6511 gold badge6 silver badges14 bronze badges 1
  • 1 Just curious, but did you try with c instanceof a? That would work in Javascript. – troelskn Commented Aug 17, 2011 at 17:44
Add a ment  | 

2 Answers 2

Reset to default 6

(Based on @troelskn 's ment)

http://jsfiddle/miriam/ugQHB/

c instanceof A

returns true.

You can use isXtype method. See docs here: Ext.AbstractComponent

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745166118a4614640.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信