/trunk/Examples/test-suite/octave/director_nested_runme.m

# · MATLAB · 39 lines · 30 code · 9 blank · 0 comment · 4 complexity · f64cbd8069264c3661947c899afc7b7c MD5 · raw file

  1. director_nested
  2. A=@() subclass(FooBar_int(),
  3. 'do_step',@(self) "A::do_step;",
  4. 'get_value',@(self) "A::get_value");
  5. a = A();
  6. if (!strcmp(a.step(),"Bar::step;Foo::advance;Bar::do_advance;A::do_step;"))
  7. error("Bad A virtual resolution")
  8. endif
  9. B=@() subclass(FooBar_int(),
  10. 'do_advance',@(self) strcat("B::do_advance;",self.do_step()),
  11. 'do_step',@(self) "B::do_step;",
  12. 'get_value',@(self) 1);
  13. b = B();
  14. if (!strcmp(b.step(),"Bar::step;Foo::advance;B::do_advance;B::do_step;"))
  15. error("Bad B virtual resolution")
  16. endif
  17. C=@() subclass(FooBar_int(),
  18. 'do_advance',@(self) strcat("C::do_advance;",self.FooBar_int.do_advance()),
  19. 'do_step',@(self) "C::do_step;",
  20. 'get_value',@(self) 2,
  21. 'get_name',@(self) strcat(self.FooBar_int.get_name()," hello"));
  22. cc = C();
  23. c = FooBar_int_get_self(cc);
  24. c.advance();
  25. if (!strcmp(c.get_name(),"FooBar::get_name hello"))
  26. error
  27. endif
  28. if (!strcmp(c.name(),"FooBar::get_name hello"))
  29. error
  30. endif