Main Content

Property Access List

This class declares access lists for the property GetAccess and Access attributes:

classdef PropertyAccess
   properties (GetAccess = {?ClassA, ?ClassB}, SetAccess = private)
      Prop1
   end
   properties (Access = ?ClassC)
      Prop2
   end
end

The class PropertyAccess specifies the following property access:

  • Gives the classes ClassA and ClassB get access to the Prop1 property.

  • Gives all subclasses of ClassA and ClassB get access to the Prop1 property.

  • Does not provide get access to Prop1 from subclasses of PropertyAccess.

  • Defines private set access for the Prop1 property.

  • Gives set and get access to Prop2 for ClassC and its subclasses.

Related Topics