classdef clA properties (Access = private) prop = 'valA'; end methods (Access = private) function privMeth (this) disp ('clA::privMeth'); end end methods function y = getProp (this, other) if nargin > 1 disp ('getProp: using "other"'); intern = clB; disp ('this.prop = '); disp (this.prop); disp ('other.prop = '); disp (other.prop); disp ('intern.prop = '); disp (intern.prop); y = other.prop; else y = this.prop; end end function callPrivMeth (this, other) if nargin > 1 disp ('callPrivMeth: using "other"'); intern = clB; disp ('this.privMeth ()'); this.privMeth (); disp ('other.privMeth ()'); other.privMeth (); disp ('intern.privMeth ()'); intern.privMeth (); else this.privMeth (); end end end end