mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-26 20:34:32 +03:00
added pointers section
This commit is contained in:
parent
0fa0305aae
commit
5eb6c15162
@ -473,7 +473,18 @@ void main() {
|
|||||||
loop.run();
|
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/).
|
* More Vala documentation can be found [here](https://valadoc.org/).
|
||||||
|
Loading…
Reference in New Issue
Block a user