Main Content

matlab.mixin.indexing.OverridesPublicDotMethodCall class

Package: matlab.mixin.indexing

Calling public methods with dot notation invokes overloaded dot indexing


Classes that inherit from matlab.mixin.indexing.RedefinesDot allow calling public methods with dot notation outside of the class. To force those calls to invoke the dotReference method instead, inherit from matlab.mixin.indexing.OverridesPublicDotMethodCall. For example, obj is an instance of a class that inherits from RedefinesDot and OverridesPublicDotMethodCall. The class defines a public method myMethod. When myMethod is called from outside the class:

  • myMethod(obj) calls the method.

  • obj.myMethod calls dotReference.

  • label="myMethod"; obj.(label) calls dotReference.

When called from inside the class, all three of these cases call the method itself instead of RedefinesDot.

OverridesPublicDotMethodCall must be used with classes that inherit from RedefinesDot, but it cannot be used with classes that inherit from matlab.mixin.indexing.ForbidsPublicDotMethodCall.

Class Attributes


For information on class attributes, see Class Attributes.

Introduced in R2021b