-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Object-Oriented JavaScript - Second Edition
By :

In this chapter you learned quite a few ways (patterns) for implementing inheritance and the following table summarizes them. The different types can roughly be divided into:
Patterns that work with constructors
Patterns that work with objects
You can also classify the patterns based on whether they:
Use the prototype
Copy properties
Do both (copy properties of the prototype)
# |
Name |
Example |
Classification |
Notes |
---|---|---|---|---|
1 |
Prototype chaining (pseudo-classical) |
Child.prototype = new Parent(); |
|
|
2 |
Inherit only the prototype |
Child.prototype = Parent.prototype; |
|
|
Change the font size
Change margin width
Change background colour