mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Moved interface into its own section and clarified constructor overloading
This commit is contained in:
parent
68951045a3
commit
ce745f43ed
@ -255,13 +255,8 @@ class Message : GLib.Object { // Class Message extends GLib's Object
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Laptop { // May only contain abstract methods
|
// Since method overloading isn't possible, you can't overload constructors.
|
||||||
public abstract void turn_on();
|
// However, you can use named constructors to achieve the same functionality.
|
||||||
public abstract void turn_off();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since method overloading isn't possible, you can use named constructors
|
|
||||||
// to get the same functionality.
|
|
||||||
|
|
||||||
public class Calculator : GLib.Object {
|
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/).
|
* More Vala documentation can be found [here](https://valadoc.org/).
|
||||||
* Read about building GUIs with GTK+ and Vala [here](http://archive.is/7C7bw).
|
* Read about building GUIs with GTK+ and Vala [here](http://archive.is/7C7bw).
|
||||||
|
Loading…
Reference in New Issue
Block a user