ES6-03: Class inheritance and extends and super keywords

extends keyword

Use the entends keyword to allow subclasses to inherit the functions of the parent class.

super keyword

  • The super keyword is used to call the normal functions and constructors of the parent class.

super calls the constructor of the parent class

Call the normal function of the parent class

Insert picture description here

super must be called before subclass this

Guess you like

Origin blog.csdn.net/sinat_41696687/article/details/113836448