Hi Nathan -
The property can only be defined in one place (i.e. the superclass). It sounds like you want TA_Component to have the Length property without a default value, but TA_rget to have a default value of 0. While you cannot override the default definition in the subclass properties block, you could set this value in the subclass constructor.
For example, if the (abstract) superclass was defined as:
classdef (Abstract) TA_Component
properties
Length;
end
end
And the subclass contained a constructor that set the Length property:
classdef TA_rget < TA_Component
methods
function obj=TA_rget
obj.Length=0;
end
end
end
The result would be that TA_rget's Length is set to 0 on construction (which is very similar to setting the default), but another subclass of TA_Component (which didn't have this custom constructor code) would have a length of empty.
More details on constructor methods can be found at:
0 Comments
Sign in to comment.