Dedian  
          -- 關注搜索引擎的開發
          日歷
          <2006年4月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456
          統計
          • 隨筆 - 82
          • 文章 - 2
          • 評論 - 228
          • 引用 - 0

          導航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 65884
          • 排名 - 816

          最新評論

          閱讀排行榜

          評論排行榜

           
          Here are some hints for difference between abstract classes and interfaces

          1. Use Interface if something will change frequently in design
          2. If the methods can be determined and implemented, use abstract classes to encapsulate them as methods of base classes and therefore can be inherited by subclasses.
          3. If you just want to declare some methods in your design which allows to be devoloped from scratch later into different classes, the interface is best choice.
          4. if need provide more common data structure, use abstract classes as base class.
          5. if want to add your code to other existing third party class for later potential requirement, interface is good to choose.
          6. Interfaces are often used to describe certain functionality of classes, thus one class can get multi-funcationlity from multiple interfaces (multiple inheritance), while an abstract class, try to describe a class's general attributes and functionalities which can be reused or re-implemented by its subclasses.
          7. in other word, Abstract class want to say is-a proposition, while Interface want to say -able or can-do proposition.

          reference:
          http://mindprod.com/jgloss/interfacevsabstract.html
          http://www.javaworld.com/javaworld/javaqa/2001-04/03-qa-0420-abstract.html
          posted on 2006-04-19 02:15 Dedian 閱讀(263) 評論(0)  編輯  收藏 所屬分類: Java Glossary
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 阿拉善盟| 富宁县| 镇宁| 厦门市| 周宁县| 安溪县| 南丹县| 龙泉市| 绵竹市| 商都县| 郴州市| 绥宁县| 华坪县| 永平县| 龙胜| 山阴县| 博爱县| 尼木县| 湘潭县| 新干县| 岫岩| 乌鲁木齐县| 蓬安县| 泸州市| 邯郸市| 禄丰县| 婺源县| 南江县| 讷河市| 勐海县| 洪江市| 乐清市| 绿春县| 阿城市| 贺州市| 当雄县| 嘉峪关市| 西丰县| 雷州市| 威远县| 福贡县|