AERYU

          ColdFusion中的繼承

          ColdFusion中的繼承體現在CFCs,用法就是在<cfcomponent>中加入屬性extends,簡單的說,sub.cfc通過繼承parent.cfc,就自動擁有了parent.cfc中的(constructor構造器中的)變量、屬性和公開的(public)方法,比如:

          <!--- parent.cfc --->
          <cfcomponent>
            <cffunction name="getSth">
              <cfreturn "this is parent class">
            </cffunction>
          </cfcomponent>

          <!--- sub.cfc --->
          <cfcomponent extends="parent">
            <cffunction name="getSthFromParent">
              <cfreturn super.getSth()>
            </cffunction>
          </cfcomponent>
          <!--- test.cfm --->
          <cfset Obj = createObject("component", "sub")>
          <cfset temp = Obj.getSthFromParent()>
          <cfoutput>#temp#</cfoutput>

          test.cfm將輸出:“this is  parent class”

          posted on 2006-02-22 08:52 AERYU 閱讀(289) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2006年2月>
          2930311234
          567891011
          12131415161718
          19202122232425
          2627281234
          567891011

          導航

          統計

          常用鏈接

          留言簿(4)

          隨筆檔案

          文章分類

          文章檔案

          新聞檔案

          configuration

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 彩票| 亳州市| 乐平市| 林周县| 甘泉县| 晴隆县| 宝丰县| 白沙| 调兵山市| 平南县| 清原| 新沂市| 全椒县| 德江县| 岳池县| 略阳县| 开阳县| 安阳市| 同德县| 山丹县| 锦屏县| 四川省| 清新县| 金溪县| 奉化市| 栾城县| 岚皋县| 浏阳市| 内黄县| 门源| 上林县| 宝坻区| 红原县| 丰宁| 武冈市| 绵竹市| 抚松县| 西平县| 甘孜县| 清涧县| 宝鸡市|