조햄의 쪼렙 탈출기

  • 홈
  • 태그
  • 방명록

Factory Method 1

kotlin in Action 4장 예제 (by, selaed, factory method, constructor)

by 예제 interface Attackable { fun attack(): String } class Knife : Attackable { override fun attack() = "attack with knife" } class Gun : Attackable { override fun attack() = "attack with gun" } class Attacker(val impl: Attackable) : Attackable by impl { fun attackEmoji() = "${attack()} 😱😵" } fun main() { println(Attacker(Knife()).attackEmoji()) println(Attacker(Gun()).attackEmoji()) } 하위 클래스가 상위..

Languages 2020.04.26
이전
1
다음
더보기
프로필사진

조햄의 쪼렙 탈출기

(현) 캐럿 (패러닷) 에서 일하는 서버 개발자 (전) 네이버 지도에서 일하는 BE 개발자 🎓 Yonsei Univ. Computer Science

  • 분류 전체보기
    • 개발log
    • error
    • Backend
    • Languages

Tag

Transactional, spring, kotlin springboot, Collection, map, kotlin in action, spring boot, lambda, kotlin java 혼용, Java, filter, SpringBoot, JPA, kotlin java, refactor, IntelliJ, pg_trgm, Error, Kotlin, refactoring,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2026/02   »
일 월 화 수 목 금 토
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28

방문자수Total

  • Today :
  • Yesterday :

Copyright © AXZ Corp. All rights reserved.

  • github

티스토리툴바