This class declares an access list for the method Access
attribute:
classdef MethodAccess methods (Access = {?ClassA, ?ClassB, ?MethodAccess}) function listMethod(obj) ... end end end
The MethodAccess
class specifies the following method access:
Access to listMethod
from an instance of MethodAccess
by methods of the classes ClassA
and ClassB
.
Access to listMethod
from an instance of MethodAccess
by methods of subclasses of MethodAccess
, because of the inclusion of MethodAccess
in the access list.
Subclasses of ClassA
and ClassB
are allowed to define a method named listMethod
, and MethodAccess
is allowed to redefine listMethod
. However, if MethodAccess
was not in the access list, its subclasses could not redefine listMethod
.