Added "Init Position Call" (takes the place of implicit constructors) and the this keyword! This was the structure needed for more sensable memory management. At least delete will need some updating before it becomes very usable, though. (Figuring out the types for function template instantiation) Anyway, good progress here!
This commit is contained in:
1 parent
82d8a15de0
commit
63d9ec66e1
7 files changed
+134
-50
No files matched your search
@@ -0,0 +1,3 @@
|
||||
4
|
||||
8
|
||||
11
|
||||
@@ -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