-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for this() as alternative ctor call
- Loading branch information
Showing
8 changed files
with
167 additions
and
78 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Foo | ||
{ | ||
int theX; | ||
|
||
// a constructor | ||
fun Foo( int x ) { x => theX; } | ||
|
||
// another constructor | ||
fun Foo() | ||
{ | ||
// call a specific constructor | ||
Foo( 5 ); | ||
} | ||
} | ||
|
||
// make a foo | ||
Foo foo; | ||
|
||
// check | ||
if( foo.theX == 5 ) <<< "success" >>>; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// test calling constructor using `this` | ||
|
||
class Foo | ||
{ | ||
int theX; | ||
|
||
// a constructor | ||
fun Foo( int x ) { x => theX; } | ||
|
||
// another constructor | ||
fun Foo() | ||
{ | ||
// call a specific constructor | ||
this( 5 ); | ||
} | ||
} | ||
|
||
// make a foo | ||
Foo foo; | ||
|
||
// should print 5 | ||
if( foo.theX == 5 ) <<< "success" >>>; | ||
|