added pointers section

This commit is contained in:
Milo Gilad 2017-08-26 11:30:06 -04:00
parent 0fa0305aae
commit 5eb6c15162

View File

@ -473,7 +473,18 @@ void main() {
loop.run();
}
// Pointers
// Pointers (manual memory management)
Object* pointer_obj = new Object(); // Creates Object instance and gives pointer
pointer_obj->some_method(); // Executes some_method
pointer_obj->some_data; // Returns some_data
delete pointer_obj;
int more = 57;
int* more_pointer = &i; // & = address-of
int indirection_demo = more_pointer*; // indirection
```
* More Vala documentation can be found [here](https://valadoc.org/).