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

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.
主站蜘蛛池模板: 区。| 株洲市| 黎川县| 大悟县| 县级市| 乌拉特后旗| 尉犁县| 博白县| 光山县| 桓仁| 泸水县| 平潭县| 衢州市| 阿拉尔市| 南通市| 奉贤区| 中宁县| 蒙阴县| 枣阳市| 即墨市| 互助| 宜昌市| 靖江市| 贵州省| 定安县| 汤原县| 泸西县| 郴州市| 博野县| 台东县| 宾川县| 海淀区| 邵武市| 凤翔县| 江城| 德化县| 沛县| 万盛区| 郓城县| 沁阳市| 奉新县|