shadowing

    [Kotlin Tips] Kotlin에서 Shadowing을 다루는 방법

    Fully Qualified Names to the Rescue! | Kotlin Tips 5월 20일에 올라온 따끈따끈한(?) 영상이다! 만약에 이런 코드가 있다고 생각해보자. package io.sebi.demo fun openFile() { println("Opening file (top level)...") } class Repo { fun openFile() { println("Opening file (repository)...") } fun readFile() { openFile() } } 이때 readFile()을 호출한다면 출력 값은 어떤게 나올까? 다들 당연히 알겠지만 Opening file (repository)...이다. 근데 Kotlin에서는 shadowing일 경우에 탑 레벨에 있..