MATLAB Object-Oriented Programming

(Joyce) #1
end
end

Inspect Class Definition

Using the EmployeeData class, create a meta.class object using the? operator:

mc = ?EmployeeData;

Determine from what classes EmployeeData derives. The returned value is a
meta.class object for the handle superclass:

a = mc.SuperclassList;
a.Name

ans =

handle

The EmployeeData class has only one superclass. For classes having more than one
direct superclass, a contains a meta.class object for each superclass.

Use an indexed reference to refer to any particular superclass:

a(1).Name

or, directly from mc:

mc.SuperclassList(1).Name

ans =

handle

The SuperclassList property contains only direct superclasses.

Inspect Properties

Find the names of the properties defined by the EmployeeData class. First obtain an
array of meta.properties objects from the meta.class PropertyList property.

mc = ?EmployeeData;
mpArray = mc.PropertyList;

The length of mpArray indicates that there are two meta.property objects, one for
each property defined by the EmployeeData class:

16 Information from Class Metadata

Free download pdf