Moved interface into its own section and clarified constructor overloading

This commit is contained in:
Milo Gilad 2017-08-26 09:09:15 -04:00
parent 68951045a3
commit ce745f43ed

View File

@ -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).