Guest User

Untitled

a guest
Dec 7th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment