O'Reilly logo

JavaScript Object Programming by Martin Rinehart

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 7

image

Inheritance Alternatives

C++ permits “multiple inheritance.” We’ll cover this next. Java simplified C++ and multiple inheritance was one of the advanced features it left out. In its place, Java featured “interfaces,” originally documented as a sort of poor man’s substitute for multiple inheritance, but in the end they proved far more valuable. (In Chapter 5, you saw that interfaces are now commonly cited as one of the main OOP concepts. Multiple inheritance is not.) I extend interfaces to “capabilities” which borrow from and extend both Java’s interfaces and JavaScript’s “mixins.” Capabilities also allow a convenient replacement for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required