Moved enum into structs and renamed section to structs and enums

This commit is contained in:
Milo Gilad 2017-08-25 10:38:25 -04:00
parent 35aa1410e2
commit 09d8feda84

View File

@ -215,7 +215,7 @@ namespace_int += 5; // Won't compile
using NamespaceDemo; using NamespaceDemo;
namespace_int += 5; // Valid namespace_int += 5; // Valid
/* Structs */ /* Structs and Enums */
struct Closet { struct Closet {
public uint shirts; // Default access modifier is private public uint shirts; // Default access modifier is private
@ -229,6 +229,13 @@ var struct_init_3 = Closet() { // Type inference also works
jackets = 3; jackets = 3;
} }
enum HouseSize { // An example of an enum
SMALL,
MODERATE,
BIG
}
/* Classes and Object-Oriented Programming */ /* Classes and Object-Oriented Programming */
class Message : GLib.Object { // Class Message extends GLib's Object class Message : GLib.Object { // Class Message extends GLib's Object
@ -271,12 +278,6 @@ public class Calculator : GLib.Object {
var calc1 = new Calculator.with_name("Temp"); var calc1 = new Calculator.with_name("Temp");
var calc2 = new Calculator.model("TI-84"); var calc2 = new Calculator.model("TI-84");
enum HouseSize {
SMALL,
MODERATE,
BIG
}
``` ```
* 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).