So, I thought a little about the suggestion from Daniel, and I came up with the following:
First, redefine the A class as:
classdef A
properties (GetAccess = public, SetAccess = protected)
foo;
end
methods
function f = get.foo(self)
f = self.get_foo_value;
end
end
methods (Access = protected)
function v = get_foo_value(self) %#ok<MANU>
v = randn(1, 1);
end
end
end
Then, rewrite the B class as:
classdef B < A
methods (Access = protected)
function v = get_foo_value(self) %#ok<MANU>
v = rand(1, 1);
end
end
end
Then instances of both A and B behave as expected, with each access of the foo member yielding a new value from the expected distribution.
Still, this seems REALLY kludgey. I guess it really comes down to the nature of the get.* methods (which I obviously don't understand).