最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论