root / branches / compiler / cSharp / ooasCompiler / doc / examples / Self.ooas
1 |
types |
---|---|
2 |
Class1 = autocons system |
3 |
|[ |
4 |
var |
5 |
O2 : Class2 = new (Class2); |
6 |
flag : bool = false |
7 |
methods |
8 |
doSomething = |
9 |
flag := true |
10 |
end |
11 |
actions |
12 |
ctr init = requires true : |
13 |
O2.init(self) |
14 |
end |
15 |
do |
16 |
init |
17 |
od |
18 |
]| ; |
19 |
Class2 = system |
20 |
|[ |
21 |
var |
22 |
O1 : Class1 = nil |
23 |
methods |
24 |
init (object : Class1) = requires (object <> nil) : |
25 |
O1 := object |
26 |
end |
27 |
end |
28 |
]| |
29 |
system |
30 |
Class1 [] Class2 |