Last active
April 5, 2016 17:29
-
-
Save tpimh/4538da5c1bd57d032b4eb1d2009a6f62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valac -o test first.vala second.vala main.vala | |
# OR | |
# ??? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class First { | |
public int a() { | |
return 4; | |
} | |
public Second get_second() { | |
return new Second(this); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Second s = new Second(new First()); | |
s.p(); | |
First f = new First(); | |
f.get_second().p(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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