Chapter 4. Inheriting and Creating Mixins

This chapter will deepen the prototypal inheritance of JavaScript, highlighting the difference with classical inheritance. It will also cover most of common patterns to implement overriding, member protection, and extension prevention. Multiple inheritance and mixins are also discussed always taking into account the new ECMAScript 6 syntax and features.

The following topics are covered in the chapter:

  • Prototypal inheritance
  • Overriding methods and properties
  • Implementing protected members
  • Controlling object extension
  • Multiple inheritance and mixins

Why inheritance?

Inheritance is one of the fundamentals principle in Object-Oriented Programming. It is usually defined as a is-a relationship between objects (or classes, ...

Get Mastering JavaScript Object-Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.