Does anyone think that it would be nice to modify the behavior of the "Restrict Property Values to Specific Classes" feature, to allow the following use case:
"myprop1_class.m":
classdef myprop1_class
end
"myprop2_class.m":
classdef myprop2_class < myprop1_class
end
"myobj1_class.m":
classdef myobj1_class
properties (Abstract)
someprop@myprop1_class
end
end
"myobj2_class.m":
classdef myobj2_class < myobj1_class
properties
someprop@myprop2_class
end
end
"test_inheritance.m":
For me, such a change looks very nice. It perfectly matches the principle, that an object “myobj2” of a class “MyClass2”, inherited from “MyClass1”, perfectly passes the “isa(myobj2,MyClass1)” check, just like in case of this new “Restrict Property Values to Specific Classes” syntax.
Moreover, note, that this check could not be implemented with a custom set(..) method for myobj1_class, cause Matlab does not allow to implement set methods for Abstract properties.
0 Comments
Sign in to comment.