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).
  • 相关阅读:
    JavaScript之DOM
    MapReduce多种join实现实例分析(一)
    JavaScript的文档对象模型DOM
    JavaScript原生实现观察者模式
    Idea环境下git 图形化操作
    一分钟教你如何实现唯美的文字描边
    Redis集群
    JAVA线程池的实际运用
    Java 线程池(ThreadPoolExecutor)原理解析
    win7开始菜单路径
  • 原文地址:https://www.cnblogs.com/feng801/p/1333527.html
Copyright © 2011-2022 走看看