MATLAB: Help for inherited method

helpinheritanceoop

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?

Best Answer

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.