# interface

```kotlin
interface Say {
    fun hello()
    fun hi() {}    //Kotlin은 Interface의 body도 구현이 가능하다.
}

class Person() : Say {
    override fun hello() { println("Hello") }
    // body가 구현된 함수는 상속받는 클래스에서 굳이 구현할 필요가 없어 중복되는 코드를 줄일 수 있다.
}

//다중상속을 이런식으로 푼다. mix-in
```

```kotlin
interface Korean {
    fun hello() { println("안녕") }
}

interface Newyorker {
    fun hello() { println("Hello") }
}

class Person(val name: String, val age: Int) : Korean, Newyorker {
    override fun hello() {
        super<Korean>.hello()
        super<Newyorker>.hello()
    }
}

// Kotlin은 서로 다른 Interface들이 같은 method 정의 및 구현이 가능하며, 각각 호출 할 수 있다.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gold.gitbook.io/kotlin/class/interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
