Skip to content · ⁨Bỏ qua nội dung⁩

Inheritance: extends, super, and overriding · ⁨Kế thừa: extends, super, và overriding⁩

English

Inheritance: building on a class

  • Inheritance lets one class reuse another class's fields and methods.
  • The class you build on is the superclass (parent); the new class is the subclass (child).
  • A subclass is-a kind of its superclass: a Dog is an Animal.

Tiếng Việt

Kế thừa: xây dựng dựa trên một class

  • Kế thừa cho phép một class tái sử dụng các trường và phương thức của một class khác.
  • Class mà bạn xây dựng dựa trên là superclass (cha); class mới là subclass (con).
  • Một subclass là-a một loại của superclass: một Dog là một Animal.

Một superclass Animal; Dog và Cat mỗi cái kế thừa nó và ghi đè speak()

Handout · ⁨Tài liệu⁩

Log in or create account · ⁨Đăng nhập hoặc tạo tài khoản⁩

IGCSE, A-Level & AP