Why does overridng the handle delete method and setting it to hidden cause a warning to be generated?
조회 수: 6 (최근 30일)
이전 댓글 표시
Background; I have a reasonably complex set of objects, and a base of 6-7 people interested in them. I've read (anecdotally) that the primary way people explore API's is via tab completion.
I don't want generic matlab handle methods confusing people with what each object does, as opposed to the nature of it being an object. Therefore I want to hide certain methods, for example, the delete method.
classdef SomeClass < handle
methods(Hidden, Access = public)
function delete(varargin)
delete@handle(varargin{:});
end
end
end
Now, this appears to generate a warning;
Warning: The following error was caught while executing 'SomeClass' class destructor:
Method 'delete' is not defined for class 'SomeClass' or is removed from MATLAB's search path.
> In restoredefaultpath (line 52)
In something (line 2)
This method is definitely defined. Can anyone offer feedback on what's happening here, as it appears illogical to me?
댓글 수: 1
Adam
2017년 8월 21일
편집: Adam
2017년 8월 21일
I don't get any warnings when I create and then delete an object of that class (in R2017a). Are you sure you cleared all objects of the class before making your changes? What is 'something' and more specifically what is it that is on line 2 that causes the error?
답변 (1개)
참고 항목
카테고리
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!