|
From: | Philip Nienhuis |
Subject: | Re: Another request for classdef test in Matlab |
Date: | Sun, 06 Jan 2013 11:23:03 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6 |
Michael Goffioul wrote:
On Sat, Jan 5, 2013 at 6:27 PM, Michael D. Godfrey <address@hidden <mailto:address@hidden>> wrote: On 01/05/2013 06:15 PM, Michael Goffioul wrote: Can you run the same tests when ClassA inherits from handle? That is: classdef ClassA < handle properties x = 1; end methods function obj = ClassA (x) if nargin > 0 obj.x = x; end end end end Actually, that's not what I wanted to test, sorry. With the class definition above (with handle as superclass), run the following instead: a(2,2) = ClassA(2) b = a a(1,1).x, b(1,1).x a(1,1) = ClassA(3) a(1,1).x, b(1,1).x
ML r2013a prerelease: >> a(2,2) = ClassA(2) a = 2x2 ClassA array with properties: x >> b = a b = 2x2 ClassA array with properties: x >> a(1,1).x, b(1,1).x ans = 1 ans = 1 >> a(1,1) = ClassA(3) a = 2x2 ClassA array with properties: x >> a(1,1).x, b(1,1).x ans = 3 ans = 1 >>
[Prev in Thread] | Current Thread | [Next in Thread] |