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

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

问题描述

我注意到在我最近修改的许多程序中,它们总是调用当前对象的父参数.我知道这是必要的,但对为什么这是一种常见做法没有充分的理解.初级开发人员的任何智慧......我应该知道这一点.

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.

推荐答案

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

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天全站免登陆