octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classdef property access test


From: Michael Goffioul
Subject: Re: Classdef property access test
Date: Mon, 20 May 2013 18:19:13 -0400

On Mon, May 20, 2013 at 5:42 PM, Michael Goffioul <address@hidden> wrote:
Can anyone test the following for me? I want to check the property access on a  value that is of handle class. Let's say you have the following 2 classes:

ClassA.m:

classdef ClassA < handle
  properties
    x = 0;
  end
end

ClassB.m:

classdef ClassB
  properties (SetAccess = private)
    a;
  end
  methods
    function obj = ClassB
      obj.a = ClassA;
    end
  end
end

Then at octave prompt:

obj = ClassB
obj
obj.a.x = 10

Michael.


For the record, I expect Matlab does not generate an error due to the private SetAccess on property 'a'.  The above could be rewritten as:
valA = obj.a
valA.x = 10

Actually, don't bother, I found the answer on-line [1], as I expected.

Michael.

[1] http://www.mathworks.com/help/matlab/matlab_oop/properties-containing-objects.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]