Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. ------------- TestClass1.m ------------------
  2. classdef TestClass1 < handle
  3. properties
  4. a;
  5. end
  6. methods
  7. function obj=TestClass1(T)
  8. display("Constructing instance of TestClass1")
  9. obj.a=T.a;
  10. end
  11. end
  12. end
  13. ------------- TestClass2.m ------------------
  14. classdef TestClass2 < handle
  15. properties
  16. a;
  17. end
  18. methods
  19. function obj=TestClass2()
  20. display("Constructing instance of TestClass2")
  21. obj.a=42;
  22. end
  23. end
  24. end
  25. ------------- objTest.m ------------------
  26. clear all;
  27.  
  28. testObj2=TestClass2(); %works
  29. testObj1=TestClass1(testObj2); %works
  30.  
  31. %failObj=TestClass1(testObj1); %does not work
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement