CHAPTER 4

image

Inheritance Practice

In this chapter we get back to coding. We’ll look at the practical steps you need to take to make OOP-style inheritance work, using JavaScript as Eich designed it.

When family E extends B, an instance of E has some of its own data and method properties, and it acquires the data and method properties of family B. Instance data properties are commonly assigned by the constructor and instance methods are commonly made available in the prototype. In this chapter you’ll see how JavaScript—plain JavaScript, library functions not required—can successfully use its hybrid class/prototypal object model to create class-based ...

Get JavaScript Object 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.