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

Chapter 20. Building Reusable Components > Components That Hold Instance Data

Components That Hold Instance Data

The ColdFusion components discussed so far in this chapter (the FilmSearchCFC and FilmDataCFC examples) have both been static components, meaning they don't hold any instance data. That is, although you can create an instance of a component with <CFOBJECT> before using it, there really isn't any need to do so. One instance of a component isn't going to behave any differently from any other instance, so it is fine to simply call the CFC's methods directly.

If you create components that hold instance data, though, each instance of the component lives on its own and has its own memory in which to store information. If your component is about films, then each instance might be an individual film and the instance data might be the film's title, budget, gross receipts, or even movie reviews. If your component is about shopping carts, then each instance of the component would represent a separate user's shopping cart, and the instance data would be the contents of the cart.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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