diff options
author | Milo Gilad <milogaccnts@gmail.com> | 2017-08-26 09:09:15 -0400 |
---|---|---|
committer | Milo Gilad <milogaccnts@gmail.com> | 2017-08-26 09:09:15 -0400 |
commit | ce745f43ed3deef655b232cb095e3d446db716a5 (patch) | |
tree | 8ffdf7f863e76bc0bc0ac1b414af9083fef26db2 /vala.html.markdown | |
parent | 68951045a37e01b677510cd44386850a69310325 (diff) |
Moved interface into its own section and clarified constructor overloading
Diffstat (limited to 'vala.html.markdown')
-rwxr-xr-x | vala.html.markdown | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/vala.html.markdown b/vala.html.markdown index 6e1a215f..923b152e 100755 --- a/vala.html.markdown +++ b/vala.html.markdown @@ -255,13 +255,8 @@ class Message : GLib.Object { // Class Message extends GLib's Object } -interface Laptop { // May only contain abstract methods - public abstract void turn_on(); - public abstract void turn_off(); -} - -// Since method overloading isn't possible, you can use named constructors -// to get the same functionality. +// Since method overloading isn't possible, you can't overload constructors. +// However, you can use named constructors to achieve the same functionality. public class Calculator : GLib.Object { @@ -383,6 +378,14 @@ public class MyHD : HardDrive { } } +// Interfaces: classes can implement any number of these. + +interface Laptop { // May only contain abstract methods + public abstract void turn_on(); + public abstract void turn_off(); +} + + ``` * More Vala documentation can be found [here](https://valadoc.org/). * Read about building GUIs with GTK+ and Vala [here](http://archive.is/7C7bw). |