为什么是this.callParent(arguments);在ExtJS中的构造函数的开头调用? [英] why is this.callParent(arguments); called at the beginning of the constructors in ExtJS?

查看:135
本文介绍了为什么是this.callParent(arguments);在ExtJS中的构造函数的开头调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在很多程序中,我最近一直在修改,他们总是调用当前对象的父参数。我知道这是必要的,但是对于为什么这是一个常见的做法没有一个坚实的理解。对于初级开发人员来说,任何智慧都是我应该知道的。

解决方案

这是ExtJS使用的机制在构造函数中支持类继承。在构造函数中调用 this.callParent(arguments)调用正在扩展的直接父类的构造函数。


I noticed that in a lot of the programs I have been modifying recently they always call the parent arguments of the current object. I know that this is needed but don't have a solid understanding as to why this is a common practice. Any wisdom out there for a junior level developer... I should know this.

解决方案

This is the mechanism that ExtJS uses to support class inheritance in constructors. Calling this.callParent(arguments) in a constructor calls the constructor of the immediate parent class that's being extended.

这篇关于为什么是this.callParent(arguments);在ExtJS中的构造函数的开头调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆