#!/usr/bin/env qore
# -*- mode: qore; indent-tabs-mode: nil -*-

%require-our
%requires qore >= 0.8
%new-style

class T1 { 
    public { int id; *T1 a; } 
    constructor(int i) { id = i; } 
    destructor() { printf("deleting %d\n", id); } 
    set(*T1 aa) { a = aa; }
}

class T2 inherits T1 {
    constructor(int i) : T1(i) {} 
}

T1 t1(1);
{
    T2 t2(2);
    t1.set(t2);
    t2.set(t1);
}
printf("t1.a: %y\n", t1.a);
#printf("before clear\n");
#t1.set();
#printf("clear\n");
