开发者

Is it possible to use a method from the parent class in the overwritten version in its child in javascript?

开发者 https://www.devze.com 2023-01-16 14:23 出处:网络
Is it possible to use a method from the parent class in the overwritten version in its child i开发者_StackOverflow中文版n javascript?Yes:

Is it possible to use a method from the parent class in the overwritten version in its child i开发者_StackOverflow中文版n javascript?


Yes:

ParentClass.prototype.methodName.call(this, arg1, arg2);


You could call the following in the overwritten version in the child class:

ParentClass.prototype.methodYouAreOverwriting.call(this);


If you are using the module pattern check out this article: http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth

0

精彩评论

暂无评论...
验证码 换一张
取 消