Object method access control
Generally, objects are not intended to create output other than returning actual variables. That is why the attributes output="false
" have been added all over the CFC code. You will also notice that there is an attribute called access="public
" in many of the methods. There are actually a number of settings for this. All of these indicate where the calling code must be for the method to run. Here is a list of the settings and definitions for each one:
Public: This is the most common and default setting, if not declared. It means that any code on the server can call the object method and it will run.
Private: In this case, the method may only be called from within the CFC. In practice, we would have taken our
setAttribute()
method and made it private. This method would normally be called only from within the actual CFC and never from outside the CFC.Package: This is the condition where code only in the same directory may call the method. The term package comes from...