Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Музычук Сб.тех.текстов для чтен. для студ. 2 ку...doc
Скачиваний:
9
Добавлен:
11.11.2019
Размер:
92.16 Кб
Скачать

Text 10

Read the following text and answer the questions to it.

Starting a new application

Topic groups

Before beginning a new application, create a folder to hold the source files.

1 Create a folder called Marine in the Projects directory off the main Delphi directory.

2 Open a new project.

Each application is represented by a project. When you start Delphi, it opens a blank project by default. If another project is already open, choose File|New Application to create a new project. When you open a new project, Delphi automatically creates the following files.

  • Projecti1 .DPR: a source-code file associated with the project. This is called a project file.

  • Unit1.PAS: a source-code file associated with the main project form. This is called a unit file.

  • Unit1.DFM: a resource file that stores information about the main project form. This is called a form file.

Each form has its own unit and form files.

3 Choose File|Save All to save your files to disk. When the Save dialog appears, navigate to your Marine folder and save each file using its default name.

Later on, you can save your work at any time by choosing File|Save All.

When you save your project, Delphi creates additional files in your project directory. You don't

need to worry about them but don't delete them.

When you open a new project, Delphi displays the project's main form, named Form1 by default. You'll create the user interface and other parts of your application by placing components on this form.

The default form has Maximize and Minimize buttons, a Close button, and a Control menu. If you run the form now by pressing F9, you'll see that these buttons all work. (To return to design mode, click the X to close the form.)

Next to the form, you'll see the Object Inspector, which you can use to set property values for the form and components you place on it.

Text 11

Read the following text and answer the questions to it.

The interface section

The interface section of a unit begins with the reserved word interface and continues until the beginning of the implementation section. The interface section declares constants, types, variables, procedures, and functions that are available toclients—that is, to other units or programs that use the unit where they are declared. These entities are called public because a client can access them as if they were declared in the client itself.

The interface declaration of a procedure or function includes only the routine's heading. The block of the procedure or function follows in the implementation section. Thus procedure and function declarations in the interface section work like forward declarations, although the forward directive isn't used.

The interface declaration for a class must include declarations for all class members.

The interface section can include its own uses clause, which must appear immediately after the word interface.

The implementation section

The implementation section of a unit begins with the reserved word implementation and continues until the beginning of the initialization section or, if there is no initialization section, until the end of the unit. The implementation section defines procedures and functions that are declared in the interface section. Within the implementation section, these procedures and functions may be defined and called in any order. You can omit parameter lists from public procedure and function headings when you define them in the implementation section; but if you include a parameter list, it must match the declaration in the interface section exactly.

In addition to definitions of public procedures and functions, the implementation section can declare constants, types (including classes), variables, procedures, and functions that are private to the unit—that is, inaccessible to clients.

The implementation section can include its own uses clause, which must appear immediately after the word implementation.