cfad47cfa3/t3compiler/tads3/test/data/inh_undef.t

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#include <tads.h>
2
3
property propNotDefined;
4
export propNotDefined;
5
6
main(args)
7
{
8
    local x = new C(new B());
9
10
    "x.p1...\n";
11
    x.p1(100);
12
13
    "\bx.p2\n";
14
    x.p2(200);
15
}
16
17
class A: object
18
    p1(x) { "This is A.p1(<<x>>)\n"; }
19
    p2(x) { "This is A.p2(<<x>>)\n"; }
20
;
21
22
class B: A
23
    p1(x) { "This is B.p1(<<x>>) - inheriting...\n"; inherited(x+1); }
24
;
25
26
class C: object
27
    construct(b) { baseobj = b; }
28
    baseobj = nil
29
    
30
    propNotDefined(prop, [args])
31
    {
32
        "This is C.propNotDefined - delegating to base object...\n";
33
        return baseobj.(prop)(args...);
34
    }
35
;
36
37
modify C
38
    p1(x) { "This is mod-C.p1(<<x>>) - inheriting...\n"; inherited(x+1); }
39
40
    propNotDefined(prop, [args])
41
    {
42
        "This is mod-C.propNotDefined - inheriting...\n";
43
        return inherited(prop, args...);
44
    }
45
;
46