Skip to content

Instantly share code, notes, and snippets.

@tpimh
Last active April 5, 2016 17:29
Show Gist options
  • Save tpimh/4538da5c1bd57d032b4eb1d2009a6f62 to your computer and use it in GitHub Desktop.
Save tpimh/4538da5c1bd57d032b4eb1d2009a6f62 to your computer and use it in GitHub Desktop.
valac -o test first.vala second.vala main.vala
# OR
# ???
class First {
public int a() {
return 4;
}
public Second get_second() {
return new Second(this);
}
}
void main() {
Second s = new Second(new First());
s.p();
First f = new First();
f.get_second().p();
}
class Second {
private First f;
public Second(First f) {
this.f = f;
}
public void p() {
print(@"$(f.a())\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment