Skip to content

1주차 전략패턴#1

Merged
guswns3371 merged 1 commit intomainfrom
1week
Oct 23, 2022
Merged

1주차 전략패턴#1
guswns3371 merged 1 commit intomainfrom
1week

Conversation

@guswns3371
Copy link
Member

No description provided.

Comment on lines 5 to 12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duck 클래스에서 따로 메소드를 구현하지 않고 FlyNoWay와 같은 다른 클래스에 구현을 위임할 수 있다

Comment on lines 6 to 32
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duck이라는 클래스에 "구현"을 하지 않고 "인터페이스"에 맞춰 프로그래밍해야 한다.

Comment on lines 7 to 19
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다형성의 활용

fly, quack 메소드 구현을 위임받은 클래스(FlyWithWings, LoudQuack)의 객체를
레퍼런스 변수(flyBehavior, quackBehavior)에 대입한다.

Comment on lines 8 to 23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@guswns3371 guswns3371 merged commit 3d1b74b into main Oct 23, 2022
@guswns3371 guswns3371 deleted the 1week branch November 5, 2022 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant