MATLAB Object-Oriented Programming

(Joyce) #1

Method Access List


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.


See Also


Related Examples



  • “Methods with Access Lists” on page 12-31


Method Access List
Free download pdf