Help for inherited method

1 Ansicht (letzte 30 Tage)
Patrick Mboma
Patrick Mboma am 8 Sep. 2015
Kommentiert: Patrick Mboma am 9 Sep. 2015
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?

Akzeptierte Antwort

Steven Lord
Steven Lord am 8 Sep. 2015
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.
  1 Kommentar
Patrick Mboma
Patrick Mboma am 9 Sep. 2015
Dear Steven,
Thank you for your answer, I did not fully understand it last time. But now I think I do.
I can write in the help for second_class to refer to help from the first_class. And then add extra lines for the specifics of the second_class.
I think this solution is more suited to this current problem but it can be used also in the my previous problem.
Thank you so much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Construct and Work with Object Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by