zoukankan      html  css  js  c++  java
  • COPY, INHERIT OR USE?

    COPY, INHERIT OR USE?

    Code reusability saves us time and effort, increasing our productivity. Object-oriented programming has something to do with that, and in the case of Delphi we can reuse forms and even entire projects. For example if we have a form with a table, a dbgrid, a navigator and several buttons, we can save it like a model in the Object Repository to reuse it in several parts of our application or other applications. The same for a standard form of the type "Save, Don't save, Cancel". To add a form to the repository you have to right-click it and select "Add to Repository..." in the context menu. To save a project in the repository choose "Add to Repository..." from the Project menu.

    To use a form of the repository in our application, in the File menu we chose New and in the New Items dialog we click the Forms tab to see the forms available in the repository. Then we select the form we want, the method of use (Copy, Inherit, or Use) and click the OK button. The dferences between these hree methods of use are described briefly here:

    COPY: Creates a form that is copy of the form that is in repository. The changes you make to the copy won't affect the form in the repository (nor other projects that use it), and changes made to the form in the repository won't affect forms previously copied from it. This option is used when the form in the repository is just a base to work, with a very low level of standardization. Full-adaptation is possible.

    INHERIT: It creates a form that derives from the form in the repository. Changes made to this derived form (inherited) won't affect the form in the repository, but the inverse is not true. This option is used when the form in the repository is well standardized but it is desired to allow some adaptation. It's the most powerful way to use a form.

    USE: It adds the form of the repository to your project. It's not a copy, but the form of the repository itself, and thus any modification that you make to it will apply to other projects that USE or INHERIT it. This option is used when the form of the repository is a standard and is defined in itself (it doesn't require particular adaptations for each case/application).
  • 相关阅读:
    2008年末纪念:回顾改变Web的十大事记
    我的Silverlight初探
    查询表字段、类型、是否主键的sql脚本
    FOR XML AUTO将数据库表的一个字段的数据查询拼接为带间隔符的字符串
    Opera:发现浏览器安全漏洞后做什么
    Spry框架实现XML分页[原]
    sql带分隔符的字符串截取
    [转]Internet数据库连接器(IDC)技术
    [摘]淘宝网的开源架构
    System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本 XP
  • 原文地址:https://www.cnblogs.com/feng801/p/1333527.html
Copyright © 2011-2022 走看看