Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Lesson 1: Creating JavaScript objects CHAPTER 6 283


FIGURE 6-8 he passing inheritance testsT

Lesson summary


■■A class is a blueprint for an object in which an object is an instance of a class.
■■The three pillars of object-oriented programming are encapsulation, inheritance, and
polymorphism.
■■The class from which you inherit is called the parent, base, super, or generalized class.
The class that is derived from the parent is called the child, derived, sub, or specialized
class. You can implement inheritance by replacing the Child class prototype with a new
instance of the parent and replacing its constructor with the Child class constructor
function.
Free download pdf