Copy, inherit or use? |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
Copy, inherit or use? 資料來源: www.delphi3000.com The three ways to use forms in the the Objects Repository 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). 網路志工聯盟----Visita網站http://www.vista.org.tw
---[ 發問前請先找找舊文章 ]---
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |