Replies: 1 comment
-
class ClassName<T : UpperBoundType> { ... }
fun <T : UpperBoundType> functionName(param: T) { ... } |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
제네릭의 타입을 특정 타입의 서브 타입으로 제한하는 것을 타입 상한 제한이라고 합니다.
장점 1) 특정 타입의 서브 타입으로 제한하면 해당 타입의 멤버에 안전하게 접근할 수 있고
장점 2) 특정 타입으로 제한하기에 코드의 의도가 명확해지고 가독성이 높아집니다.
Beta Was this translation helpful? Give feedback.
All reactions