Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
57 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package _01_intro | ||
|
||
fun main(args: Array<String>) { | ||
println("abc".last()) | ||
} | ||
|
||
fun String.last(): Char { | ||
return this[length - 1] | ||
} |
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,15 @@ | ||
package _02_bridges | ||
|
||
fun foo( | ||
a: Int, | ||
b: String = "default", | ||
c: String? = null | ||
) { | ||
println(a) | ||
println(b) | ||
println(c) | ||
} | ||
|
||
fun main(args: Array<String>) { | ||
foo(1) | ||
} |
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,11 @@ | ||
package _02_bridges | ||
|
||
abstract class WithDefault { | ||
abstract fun foo(a: Int = 1) | ||
} | ||
|
||
class ChildWithDefault: WithDefault() { | ||
override fun foo(a: Int) { | ||
println(a) | ||
} | ||
} |
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,5 @@ | ||
package _02_bridges.java; | ||
|
||
public class Base<T> { | ||
T foo(T t) { return t; } | ||
} |
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,8 @@ | ||
package _02_bridges.java; | ||
|
||
public class Child extends Base<Integer> { | ||
@Override | ||
Integer foo(Integer s) { | ||
return s; | ||
} | ||
} |
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,9 @@ | ||
package _02_bridges | ||
|
||
trait Trait { | ||
fun foo() {} | ||
} | ||
|
||
class C: Trait { | ||
|
||
} |