Skip to content · ⁨본문 바로가기⁩
English

Polymorphism: one type, many behaviours

  • Polymorphism means "many forms": one superclass type, many subclass behaviours.
  • You can hold a Dog or a Cat in an Animal variable, because each is-an Animal.
  • When you call a method, the object's real type decides which version runs.

한국어

다형성: 하나의 타입, 여러 행동

  • 다형성은 '다양한 형태'를 의미합니다: 하나의 슈퍼클래스 타입, 여러 서브클래스 행동.
  • Dog이나 Cat을 Animal 변수에 담을 수 있으며, 이는 각각 is-an Animal이기 때문입니다.
  • 메소드를 호출할 때, 객체의 실제 타입이 어떤 버전이 실행될지 결정합니다.

한 번의 call a.speak() 호출이 객체의 실제类型에 따라 Woof, Meow 또는 Moo를 출력합니다

Handout · ⁨교재 자료⁩

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP