42 lines
799 B
Text
42 lines
799 B
Text
class HelloWorld: Object {
|
|
|
|
public signal void some_event ();
|
|
|
|
public void method () {
|
|
some_event ();
|
|
}
|
|
|
|
struct Vector {
|
|
public double x;
|
|
public double y;
|
|
public double z;
|
|
}
|
|
|
|
enum WindowType {
|
|
TOPLEVEL,
|
|
POPUP
|
|
}
|
|
|
|
private uint year = 0;
|
|
|
|
public HelloWorld () {
|
|
}
|
|
|
|
public HelloWorld.with_year (int year) {
|
|
if (year>0)
|
|
this.year = year;
|
|
}
|
|
|
|
public void greeting () {
|
|
if (year == 0)
|
|
print ("Hello World\n");
|
|
else
|
|
/* Strings prefixed with '@' are string templates. */
|
|
print (@"Hello World, $(this.year)\n");
|
|
}
|
|
}
|
|
|
|
void main (string[] args) {
|
|
var helloworld = new HelloWorld.with_year (2021);
|
|
helloworld.greeting ();
|
|
}
|