Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
⊗jsOpIhHr 39 of 60 menu

Class Inheritance Hierarchy in OOP in JavaScript

It is possible to inherit from a class that is itself a descendant. Let's look at an example. Let's say we have the following parent class:

class User { setName(name) { this._name = name; } getName() { return this._name; } }

The following class inherits from this class:

class Student extends User { setYear(year) { this._year = year; } getYear() { return this._year; } }

And another class inherits from this class:

class StudentProgrammer extends Student { setSkill(skill) { this._skill = skill; } getSkill() { return this._skill; } }

Make a class Employee that will inherit from the class User.

Make a class Programmer that will inherit from the class Employee.

Make classes Designer that will inherit from class Employee.

Add various methods to the classes you created.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline