• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 21. Packaging Data and Functions... > Overriding Inherited Properties

Overriding Inherited Properties

The Bird-Raptor-Eagle-BaldEagle inheritance chain in Chapter 15 is just a skeleton because the bottom three classes don’t do anything useful. One thing a subclass might do is add a new property. For instance, because raptors are birds of prey, the Raptor class might add a prey property, possibly an array of items on the Raptor menu, like this:

Raptor.prototype.prey = [“mice”, “rabbits”, “fish”]; 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint