Fixed up testing etc
This commit is contained in:
26
tests/test_declarationsTest.krak
Normal file
26
tests/test_declarationsTest.krak
Normal file
@@ -0,0 +1,26 @@
|
||||
import io:*;
|
||||
import mem:*;
|
||||
|
||||
typedef ClassWithConstructor {
|
||||
|int| data;
|
||||
|ClassWithConstructor*| construct(|int| inData) {
|
||||
data = inData;
|
||||
return this;
|
||||
}
|
||||
|void| printData() {
|
||||
println(data);
|
||||
}
|
||||
};
|
||||
|
||||
|int| main() {
|
||||
|ClassWithConstructor| object.construct(4);
|
||||
//ClassWithConstructor object;
|
||||
//object.construct(4);
|
||||
object.printData();
|
||||
|int| a = 8;
|
||||
println(a);
|
||||
|ClassWithConstructor*| objPtr = new<ClassWithConstructor>()->construct(11);
|
||||
objPtr->printData();
|
||||
delete<ClassWithConstructor>(objPtr);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user