I have a class defined as follows:
classdef testClassDynProps<dynamicprops methods function obj=testClassDynProps metaProp = obj.addprop('testProp'); metaProp.SetMethod = @(obj,val) (testClassDynPropsSetMet(obj,val)); metaProp.GetMethod = @(obj) (testClassDynPropsGetMet(obj)); end % constructor
endend
I invoke this as follows:
t=testClassDynProps;t.testProp = 3; % this will result in infinite recursion
a = t.testProp; % this will result in infinite recursion
I receive the following error message:
??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer. Error in ==> testClassDynProps>@(obj,val)(testClassDynPropsSetMet(obj,val))
The Set and Get methods of a dynamic property created with addprops in a subclass of dynamicprops create infinite recursions, because the Get/Set functions call themselves.
Best Answer