Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

17.functionextension

fun main(args : Array<String>){
    var 문자열 : String  = "일반 문자열";
    println (
        문자열.추가함수("추가함수")
    );

}

// 이미 만들어진 객체에 함수를 추가할 수 있다.
fun String?.추가함수(s : String ) : String{
    return "나는 $this 너는 $s";
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.