daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. classdef AClass
  2.   properties
  3.     A;
  4.   end
  5.   methods
  6.     function obj = ChangeA(obj, a)
  7.       obj.A = mz;
  8.     end
  9.     function obj = CallChangeA(obj)
  10.       obj.ChangeA(4);
  11.       %obj = obj.ChangeA(4);
  12.       %ChangeA(obj, 4);
  13.       %obj = ChangeA(obj, 4);
  14.       % none of these works
  15.     end
  16.   end
  17. end
  18.  
  19. % ------ script:
  20. a1 = A;
  21. a1.A = 1;
  22. a1.ChangeA(2); % a1.A = 2
  23.  
  24. a2 = A;
  25. a2.A = 3;
  26. a2.CallChangeA(); % a2.A = 3 !!!  not four
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top