[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help with methods()
From: |
Rik |
Subject: |
Help with methods() |
Date: |
Fri, 22 Feb 2019 08:33:31 -0800 |
Trying to determine which methods are returned in Matlab from the methods()
function. Could someone take the following code and put it in to a file
called "testclass.m".
-- START testclass.m --
classdef testclass
properties
testnumber = 0;
end
methods
function p = testclass()
p.testnumber = 1337;
end
function result = getNumber(obj)
result = obj.testnumber;
end
end
methods (Access = private)
function result = privatemtd (obj)
result = obj.testnumber;
end
end
methods (Access = protected)
function result = protectedmtd (obj)
result = obj.testnumber;
end
end
methods (Hidden = true)
function result = hiddenmtd (obj)
result = obj.testnumber;
end
end
end
-- END testclass.m --
Next, run the following and post the results.
-- START code --
x = testclass
methods (x)
methods (x, '-full')
-- END code --
One question is whether all public methods, including the constructor, are
returned. The second question is whether protected or private methods are
returned. Third question is whether hidden methods are returned.
--Rik
- Help with methods(),
Rik <=