1: #line 3661 "./lpsrc/flx_tutorial.pak"
2:
3: open Long;
4:
5: class Y[t] {
6:
7: val c : int;
8: var x : t;
9: var y : long;
10:
11:
12: fun fetchc():int =>c;
13:
14:
15: proc setx(a:t) { x = a; }
16: proc setxy( a:t, b:long) { x = a; y = b; }
17:
18:
19: proc yprint(xprint:t->0) {
20: print "This is a Y object, with x = ";
21: xprint x; print ", y = "; print y;
22: print ", and c = "; print c; endl;
23: }
24:
25:
26:
27: fun f(a:int,add:int * t->int):int => g$ a,add;
28: fun g(a:int,add:int * t->int):int => a + x;
29:
30:
31: ctor () {}
32: ctor (a:int): c(20000) { x = a; }
33:
34:
35: fun p[u](a:u, add:t * u ->int):int => x + a;
36: };
37:
38: var ob <- new Y[int](99);
39: ob.x = 2;
40: ob.y = 3L;
41:
42: print ob.c; endl;
43: print ob.x; endl;
44: print ob.y; endl;
45: print$ ob.fetchc(); endl;
46:
47: proc iprint(x:int) { print x; }
48:
49: ob.setx 22;
50: ob.yprint(iprint of (int));
51:
52: ob.setxy (12,33L);
53: ob.yprint(iprint of (int));
54:
55: print$ ob.f (1,add of (int*int)); endl;
56: print$ ob.p[int] (1,add of (int*int)); endl;
57: