PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Objective C | 44 lines | 31 code | 13 blank | 0 comment | 8 complexity | 010e2a8f3e12a660ec6f6b89f629f5fd MD5 | raw file
 1director_abstract
 2
 3MyFoo=@() subclass(director_abstract.Foo(),@ping);
 4function out=ping(self)
 5  out="MyFoo::ping()";
 6end
 7
 8
 9a = MyFoo();
10
11if (!strcmp(a.ping(),"MyFoo::ping()"))
12  error(a.ping())
13endif
14
15if (!strcmp(a.pong(),"Foo::pong();MyFoo::ping()"))
16  error(a.pong())
17endif
18
19
20MyExample1=@() subclass(director_abstract.Example1(),'Color',@(self,r,g,b) r);
21MyExample2=@(a,b) subclass(director_abstract.Example2(a,b),'Color',@(self,r,g,b) g);
22MyExample3=@() subclass(director_abstract.Example3_i(),'Color',@(self,r,g,b) b);
23
24me1 = MyExample1();
25if (director_abstract.Example1.get_color(me1, 1,2,3) != 1)
26  error
27endif
28
29me2 = MyExample2(1,2);
30if (me2.get_color(me2, 1,2,3) != 2)
31  error
32endif
33
34me3 = MyExample3();
35if (me3.get_color(me3, 1,2,3) != 3)
36  error
37endif
38
39
40# don't check that we cannot construct abstract bases, since we have no
41# way of disambiguating that with the normal construction case using
42# subclass. furthermore, calling a pure virtual method will still generate
43# an error.
44