Skip to content

Commit

Permalink
tweak class examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Dec 1, 2024
1 parent 6b8acda commit ec6ed83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions examples/class/constructors.ck
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class Foo
<<< "constructor 2:", x >>>;
}

// constructor 3 (alternate method to define)
fun void Foo( int x, int y )
// constructor 3
// (using class name OR @construct is interchaneable)
fun Foo( int x, int y )
{
x*y => num;
<<< "constructor 3:", x, y >>>;
Expand Down
7 changes: 4 additions & 3 deletions examples/class/ctors-dtor.ck
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ class Foo
fun @construct() { 2 => num; }

// another constructor
fun @construct( int x ) { x => num; }
// (using class name OR @construct is interchaneable)
fun Foo( int x ) { x => num; }

// yet another constructor
fun @construct( int x, int y ) { x*y => num; }

// alternate way of define a constructor
fun void Foo( int x, int y, int z ) { x*y*z => num; }
// yet another constructor
fun Foo( int x, int y, int z ) { x*y*z => num; }

// destructor
fun @destruct() { <<< "destructor:", this.num >>>; }
Expand Down
2 changes: 1 addition & 1 deletion examples/import/import-test-3.ck
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
<<< Foo.S_VEC3 >>>;
for( auto i : Foo.S_INT_ARRAY ) <<< i >>>;
<<< Foo.S_STRING >>>;
<<< Foo.S_SINOSC.freq() >>>;
<<< Foo.S_SINOSC.freq() >>>;

0 comments on commit ec6ed83

Please sign in to comment.