Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITEM 31. 한정적 와일드카드를 사용해 API 유연성을 높이라 #58

Open
SGKIM94 opened this issue Apr 5, 2021 · 0 comments
Assignees
Labels
Assignment Something to submit

Comments

@SGKIM94
Copy link
Collaborator

SGKIM94 commented Apr 5, 2021

매개변수화 타입은 불공변이기 때문에 발생하는 상황을 대처하기 위해서 와일드카드 타입을 사용할 수 있습니다.
이러한 와일드카드를 사용할 때 유연성을 극대화하려면 원소의 생산자나 소비자용 입력 매개변수에 와일드카드 타입을 사용하라. 를 인지하고 사용해야 합니다.

책에서는 아래처럼

팩스(PECS): producer-extends, cusumer-super

이러한 공식을 설명합니다.

위의 공식이 성립하는 간단한 예제를 작성해 봅시다.

@SGKIM94 SGKIM94 added the Assignment Something to submit label Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Assignment Something to submit
Projects
None yet
Development

No branches or pull requests

4 participants