Fixed up testing etc
This commit is contained in:
30
tests/test_simpleObjectTemplateTest.krak
Normal file
30
tests/test_simpleObjectTemplateTest.krak
Normal file
@@ -0,0 +1,30 @@
|
||||
import io;
|
||||
|
||||
|
||||
typedef template <T> TemplateTest {
|
||||
|int| a;
|
||||
|T| b;
|
||||
|void| print() {
|
||||
io::print("a: ");
|
||||
io::print(a);
|
||||
io::print("\n");
|
||||
io::print("b: ");
|
||||
io::print(b);
|
||||
io::print("\n");
|
||||
}
|
||||
};
|
||||
|
||||
|int| main() {
|
||||
|
||||
|TemplateTest<int>| test;
|
||||
|TemplateTest<char*>| test2;
|
||||
test.a = 5;
|
||||
test.b = 7;
|
||||
test2.a = 9;
|
||||
test2.b = "Hello Templates!";
|
||||
|
||||
test.print();
|
||||
test2.print();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user