Main Content

matlab.mixin.SetGetExactNames class

Package: matlab.mixin Package
Superclasses: matlab.mixin.SetGet

Require exact name match for set and get methods

Description

Use the matlab.mixin.SetGetExactNames class to derive classes that inherit methods named set and get that set and get property values. For information on how to use the set and get methods, see the MATLAB® set and get functions.

Classes derived from matlab.mixin.SetGetExactNames require case-sensitive, exact property name matches. To support inexact name matches, derive from the matlab.mixin.SetGet class.

The matlab.mixin.SetGetExactNames class is a handle class.

Class Attributes

Abstract
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Methods

expand all

Examples

collapse all

Define a class that has two properties.

classdef PropSetGet < matlab.mixin.SetGetExactNames
   properties
      Number {mustBeNumeric} 
      Str string
   end
end

Create an instance of the class and try to use the inherited set method to set a property value. The method fails because the property name must be a case-sensitive match for the name defined in the class.

p = PropSetGet;
set(p,'number',8)
Error using PropSetGetExact/set
The name 'number' is not an accessible property for an instance of class 'PropSetGetExact'.
Introduced in R2016b