Files
kraken/tests/test_destructorTest.krak

29 lines
471 B
Plaintext
Raw Normal View History

import io:*;
typedef DestructorPrint {
var myStr: char*;
fun construct(str: char*): DestructorPrint* {
myStr = str;
return this;
}
fun destruct(): void {
println(myStr);
}
};
typedef NoDistruction {
var a: int;
fun dummyFunc(): void {}
};
fun indirPrint(): void {
var testObj.construct("Hello Destructors!"): DestructorPrint;
var dummy: NoDistruction;
}
fun main(): int {
indirPrint();
return 0;
}