Предмет: Информатика, автор: ДенPatriot

Рассказать и показать на примере Паскаль:

1) Что такое absolute и для чего нужна?

2)  Что такое asm и для чего нужна? 

3)  Что такое constructor и destructor и для чего нужна?  

4) Что такое  implementation  и для чего нужна?

5) Назовите модули Паскаль ( в строке Uses, например crt) и какие возможности этот модуль дает?

6) Что за тип переменной: указательный (Pointer) 

7) И на последок: что означает символ @ , #, $ , ^

 

Ответы

Автор ответа: emblerik
0

1) absolute - директива для задания адреса переменной.
Например:
var
a : integer absolute $0040:$0002; //Сеегмент:смещение

2) asm - директива для ассемблерных вставок.
используется в критичных участках кода.
пример:

begin
asm
xor ax, ax
end
end.

3)
Конструктор и деструктор нужны для создания и уничтожения экземпляра класса.
Существуют конструкторы/деструкторы по умолчанию, но если мы хотим заменить его своим, то используются constructor/destructor.
Пишется просто - вместо function/procedure пишется constructor/destructor, ну и в классе прописывается.
type
ooo = class
public
a, b : integer;
constructor create (x, y : integer);
end;

constructor ooo.create (x, y : integer);
begin
a := x;
b := y;
end;

4)
implementation - в модуле обозначает начало исполняемой части, то есть там сами функции, процедуры и инициализация модуля.
Нужна, разумеется, чтобы отделить части модуля друг от друга.

Пример модуля:

Unit embler;

Interface

Procedure AddS (x,y: integer, var z: integer);

Implementation
Procedure AddD (x,y: integer, var z: integer);
begin
z := 2 * x + y;
end;
end.

5) Например, Graph - позволяет работать с графикой,
Math - математические функции, Windows - системные функции.

6) Pointer хранит адрес. По этому адресу можно пойти и взять значение переменной, при этом неважно какого она типа. Там, например может быть массив.

7) @ - берет адрес переменной
^ - обозначение, что это указатель ИЛИ что это разыменование

пример:
var
a : ^integer; // указатель на Integer;
b : integer;
begin
a := @b;
b := a^ + 2; //То же самое, что b := b + 2;
end.

Похожие вопросы
Предмет: Английский язык, автор: bshe59
I. Reading
Task. Read the article about London police.

The History of the London Police

In 1700 London had no policemen at all. A few men protected the city streets at night.
Many people were poor and there were so many thieves who stole money in the streets that people stayed in their homes as much as possible.
In 1750, Henry Fielding started to pay a group of people to stop thieves. They were like policemen and were called ‘Bow Street Runners’ because they worked near Bow Street.
Fifty years later, there were 120 Bow Street Runners, but London had become very big and needed more policemen. In 1829, the first London Police Force was started with 3000 officers. Most of the men worked on foot, but a few rode horses.
Today, London police are quite well paid and for the few police officers who still ride horses, the pay is even better than for the others.
​​​​​​​​​​​
Choose True or False.
1. In 1800, there were not enough policemen in London.​​​​[1]
True ​​ False
2. All of the first 3000 London Police Force rode horses.​​​​[1]
True ​​False
3. Today, police officers who work with horses are paid more than their colleagues.
True ​​False ​​​[1]
​​​​​​​​​​ Total [3]
II. Grammar
​Choose the correct preposition.

1. When did the colonists arrive in/ at America?
2. According of/to legend, a giant built the bridge.
3. She stayed in/at prison for a year.
4. Bauyrzhan Momyshuly fought to/in many battles.
Total [4]

III. Complete the sentences
1. Abraham Lincoln was……
2. Toktar Aubakirov was the first Kazakh to…..
3. Florence Nightingale was called…..
4. Finn MacCool was Benandonner?s…..
Total [4]

IV. Writing
Task. Choose ONE of the topics below.

Topic 1. Our class
Think about your favourite class. Give some information about the subject and classmates.

▪ What is your favourite subject? Why?
▪ What does a person do to be good at school?
▪ Do you enjoy spending time with your classmates? Why?
▪ What clubs or sport activities do you like most at your school? Why?

Topic 2. Helping and Heroes
Think about heroes of modern life. Give some information about any hero.


▪ Who do you think is a hero of modern life? Why?
▪ What does a hero do?
▪ Why do heroes enjoy helping the other people?
▪ Who is your superhero or a hero in real life? Why?
Total [4]