MATLAB Object-Oriented Programming

(Joyce) #1
ans =

0

dv = mp.DefaultValue;

No default value has been defined for property Foo

Abstract Property

MyClass defines the Foo property as Abstract:

classdef MyAbst
properties (Abstract)
Foo
end
end

The meta.property instance for property Foo has a value of false for its HasDefault
property because you cannot define a default value for an Abstract property. Attempting
to access DefaultValue causes an error:

mc = ?MyAbst;
mp = mc.PropertyList(1);
mp.HasDefault

ans =

0

dv = mp.DefaultValue;

Property Foo is abstract and therefore cannot have a default value.

Property with Expression That Errors

MyPropEr defines the Foo property default value as an expression that errors when
evaluated.

classdef MyPropEr
properties
Foo = sin(pie/2)
end
end

16 Information from Class Metadata

Free download pdf