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

Inheritance

Just as we can use the word “my” to refer to a CFC's THIS scope (“my ID is 123 and my First Name is Fred…”), in inheritance, we can think of the words is a. An actor is a person. A cat is a mammal. A novel is a book. In these cases, actor, cat, and novel are “children” of person, mammal, and book. Some parents can exist by themselves; there can be a person who is not an actor. Some other parents, though, are abstract; you will never see a creature in the zoo called, simply, “mammal.” Rather, the parent is intended as more of a handy template upon which more specific things can be based. Although two different mammals share some characteristics by virtue of being mammals (they are warm-blooded and give birth to live young, for example), they can be made different either by having unique properties and behaviors, or by modifying some aspect of the parent (consider the egg-laying platypus!).

Our list of known facts in the movie studio application included the statements that actors and directors are both types of people with some common properties and some unique. So by being types of “people,” you could create a component to represent a “person” and have each of these variants inherit from it.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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