O'Reilly logo

Object-Oriented Programming in ColdFusion by Matt Gifford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing your CFC

Once you are ready to use your CFCs, you need to access the methods placed within. There are two ways to access a CFC:

  • object instantiation
  • invoking the CFC

Instantiating the object

When you instantiate a CFC, you create an instance of the component. This instance preserves the data within the CFC for as long as it exists. You would typically create an instance of a component at the top of the page. By doing so, you would have access to its methods and functions on the entire page, without having to create a new instance for each call.

There are three methods available to you to create an instance of the CFC:

  • createObject
  • cfobject
  • using the NEW operator in ColdFusion 9

Using the createObject function

As used in our earlier examples, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required