calling super class method which has a different name
显示 更早的评论
Hello,
i am wondering that a derived class cannot call all methods from the super class. It is restricted to the same name!
Are there plans to change this in near future? Whats the sense of this restriction? Is there a possibility to avoid it?
回答(2 个)
Daniel Shub
2011-9-22
0 个投票
Are there plans to change this in near future?
Only an employee of TMW can tell you that.
Assume:
- A class hierarchy of subsubclass < subclass < superclass.
- superclass defines a method methodA
- subsubclass overloads methodA
- subclass defines a method methodB
The overloaded methodA can call the non-overloaded superclass methodA by methodA@superclass( ... ). This allows you to easily extend methods. It sounds like you want to make methodB call the non-overloaded methodA by doing methodA@superclass instead of the overloaded methodA, which is simply called by methodA( ... ). I think this is a bad idea. There is probably a reason the subsubclass overloaded methodA and you are bypassing it. Do you have an example where bypassing the overloaded method is helpful?
类别
在 帮助中心 和 File Exchange 中查找有关 Noncentral t Distribution 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!