官术网_书友最值得收藏!

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 the object-oriented world and it is an interesting way to protect code integrity.
  • Remote: Here is one of the most powerful aspects of ColdFusion. This is actually what is called a web service. Just setting this exposes the object to the outside world. We will cover more about this later.
主站蜘蛛池模板: 宁阳县| 资兴市| 东台市| 金阳县| 缙云县| 五台县| 金堂县| 石渠县| 青阳县| 巴楚县| 河源市| 肇州县| 鄯善县| 洪泽县| 吴川市| 班玛县| 安远县| 英吉沙县| 赤水市| 永州市| 嘉黎县| 平远县| 贡觉县| 永登县| 赤城县| 开原市| 古丈县| 大悟县| 夏河县| 浦东新区| 内江市| 定边县| 新平| 苗栗市| 平泉县| 临洮县| 恩平市| 湖北省| 长岛县| 建平县| 开远市|