Main Content

matlab.mixin.indexing.OverridesPublicDotMethodCall Class

Namespace: matlab.mixin.indexing

Calling public methods with dot notation invokes overloaded dot indexing

Since R2021b

Description

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

Abstract
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Version History

Introduced in R2021b