29 lines
423 B
Plaintext
29 lines
423 B
Plaintext
|
|
import io;
|
||
|
|
|
||
|
|
typedef DestructorPrint {
|
||
|
|
char* myStr;
|
||
|
|
DestructorPrint* construct(char* str) {
|
||
|
|
myStr = str;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
void destruct() {
|
||
|
|
println(myStr);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
typedef NoDistruction {
|
||
|
|
int a;
|
||
|
|
void dummyFunc() {}
|
||
|
|
};
|
||
|
|
|
||
|
|
void indirPrint() {
|
||
|
|
DestructorPrint testObj.construct("Hello Destructors!");
|
||
|
|
NoDistruction dummy;
|
||
|
|
}
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
indirPrint();
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|