Help for inherited method
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Patrick Mboma
le 8 Sep 2015
Commenté : Patrick Mboma
le 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?
0 commentaires
Réponse acceptée
Steven Lord
le 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!