summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xvala.html.markdown15
1 files changed, 15 insertions, 0 deletions
diff --git a/vala.html.markdown b/vala.html.markdown
index 51cb8dc0..350d3d88 100755
--- a/vala.html.markdown
+++ b/vala.html.markdown
@@ -410,6 +410,21 @@ var type_name = type_info2.name();
Type type_info3 = typeof(Linux);
Linux type_demo = (Linux) Object.new(type_info3);
+// Generics
+
+class Computer<OperatingSystem> : GLib.Object {
+ private OperatingSystem os;
+
+ public void install_os(OperatingSystem os) {
+ this.os = os;
+ }
+ public OperatingSystem retrieve_os() {
+ return this.os;
+ }
+}
+
+var new_computer = new Computer<Linux>();
+
```
* More Vala documentation can be found [here](https://valadoc.org/).
* Read about building GUIs with GTK+ and Vala [here](http://archive.is/7C7bw).