Inheritance (extends)

Inheritance is an Object Oriented concept that establishes a relationship between a Parent (/Super) class and a Child (/Sub) class.


The child is said to inherit the members of the parent.


The keyword extends is used in the class signature, as can be seen on line 8 as follows:

Save and refresh browser:

Hi, my name is Julia, and I'm a Scientist!
I also have long blonde hair!!


The new Scientist class has extended the Person class, and in this case has also overridden the speak() method of the parent.

Leave a Reply