2014-12-30 01:22:09 -05:00
|
|
|
import io:*;
|
2014-06-28 08:31:33 -07:00
|
|
|
|
|
|
|
|
typedef DestructorPrint {
|
2014-08-01 00:45:48 -07:00
|
|
|
|char*| myStr;
|
|
|
|
|
|DestructorPrint*| construct(|char*| str) {
|
2014-06-28 08:31:33 -07:00
|
|
|
myStr = str;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2014-08-01 00:45:48 -07:00
|
|
|
|void| destruct() {
|
2014-06-28 08:31:33 -07:00
|
|
|
println(myStr);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef NoDistruction {
|
2014-08-01 00:45:48 -07:00
|
|
|
|int| a;
|
|
|
|
|
|void| dummyFunc() {}
|
2014-06-28 08:31:33 -07:00
|
|
|
};
|
|
|
|
|
|
2014-08-01 00:45:48 -07:00
|
|
|
|void| indirPrint() {
|
|
|
|
|
|DestructorPrint| testObj.construct("Hello Destructors!");
|
|
|
|
|
|NoDistruction| dummy;
|
2014-06-28 08:31:33 -07:00
|
|
|
}
|
|
|
|
|
|
2014-08-01 00:45:48 -07:00
|
|
|
|int| main() {
|
2014-06-28 08:31:33 -07:00
|
|
|
indirPrint();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|