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

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

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

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

T t1(1);
T1 t2(2);
printf("before first set\n");
t1.set(t2);
printf("first set\n");
t2.set(t1);
printf("before clear\n");
t1.set();
printf("clear\n");
