overwrite Handle class - hide 'isvalid' function and 'ObjectBeingDestroyed' event
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dennis
am 25 Jun. 2019
Kommentiert: Dennis
am 25 Jun. 2019
Dear all,
I want to make a class that is to be used by people that are very unfamiliar with Matlab and they will be using the class by consulting doc('myClass'). The class is based on the handle class, the problem is that the functions inherited from the handle class are also displayed in the documentation. Some of these inherited functions can be hidden by overwritting them as follows (link to original post):
classdef myClass < handle
methods (Hidden)
function lh = addlistener(varargin)
lh = addlistener@handle(varargin{:});
end
function notify(varargin)
notify@handle(varargin{:});
end
function delete(varargin)
delete@handle(varargin{:});
end
function Hmatch = findobj(varargin)
Hmatch = findobj@handle(varargin{:});
end
function p = findprop(varargin)
p = findprop@handle(varargin{:});
end
function TF = eq(varargin)
TF = eq@handle(varargin{:});
end
function TF = ne(varargin)
TF = ne@handle(varargin{:});
end
function TF = lt(varargin)
TF = lt@handle(varargin{:});
end
function TF = le(varargin)
TF = le@handle(varargin{:});
end
function TF = gt(varargin)
TF = gt@handle(varargin{:});
end
function TF = ge(varargin)
TF = ge@handle(varargin{:});
end
end
end
However, the 'isvalid' function is 'sealed' and cannot be overwritten to hide it. The event 'ObjectBeingDestroyed' can also not be overwritten to hide it.
My question is therefore, is it possible to copy the source code of the original handle class into a new custom class which can then be altered to hide all the functions and events? Or is there some other way to hide this function and event?
Kind regards,
Dennis
0 Kommentare
Akzeptierte Antwort
Guillaume
am 25 Jun. 2019
is it possible to copy the source code of the original handle class
No, we don't have access to that source code. In any case it's a fundamental base clase compiled into matlab executable, I doubt you'd be able to reproduce its behaviour purely in m code.
At this point, I think you need to bite the bullet and write your own custom documentation rather than relying on the autogenerated one.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Function Handles 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!