From 5eb6c15162a1a15507fb20497a02d17a7d6a926a Mon Sep 17 00:00:00 2001 From: Milo Gilad Date: Sat, 26 Aug 2017 11:30:06 -0400 Subject: added pointers section --- vala.html.markdown | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'vala.html.markdown') diff --git a/vala.html.markdown b/vala.html.markdown index 5ff3486c..9a48aee9 100755 --- a/vala.html.markdown +++ b/vala.html.markdown @@ -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/). -- cgit v1.2.3