I would like to define an interface with properties in an abstract class like this
classdef A
properties (Abstract = true)
Valid;
end
end
with an implementation of this interface like this
classdef B < A
properties (Dependent = true)
Valid;
end
methods
function v = get.Valid(obj)
v = 1;
end
end
end
but when I try to make an instance of B I get the following error
>> c = B()
??? Error using ==> B
The property 'Valid' restriction defined in class 'B' must match the property definition in base class 'B'.
Can anyone tell me what I doing wrong?
Try setting the
Dependentproperty attribute in the base class as well:According to the documentation:
The way I understood this, subclass property attributes must match the base class (without the
Abstractproperty)