Help for inherited method
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have the following problem. I have two classes, say second_class and first_class, where second_class<first_class i.e. second_class inherits from first_class . Both of those classes have a method, say "do_something" and I would like to write Help for "do_something" in second_class. In this method, second_class first applies do_something from first_class and then does some further processing. I guess there is no way to "inherit" the help from first_class and then add a description of what is specific to second_class. I just have to manually copy the help from first_class, paste it in second_class and then add the specifics of second_class. Am I wrong on this? The setup for second_class could look as follows:
classdef second_class < first_class
properties
...
end
methods
function out=do_something(varargin)
out=do_something@first_class(varargin{:})
out=do_something_else(out);
end
end
end
The problem is somewhat related to a question I asked earlier but it is slightly different. There I was asking whether two functions with identical behavior could share the same help without having to copy and paste.
There was an indirect solution that I liked very much, but I guess it cannot be applied to this case?
댓글 수: 0
채택된 답변
Steven Lord
2015년 9월 8일
No, there is no way to "inherit" help text. You could do something similar to what IMAGESC does, which is to say that IMAGESC behaves like IMAGE except for ... and have your function See Also the method of the base class that it invokes.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!