Answer the question
In order to leave comments, you need to log in
Why does PascalABC.NET throw an error when creating an object?
Hello!
When completing a task in Pascal, an error appears:
This is an OOP task, just throw in the condition:
Describe the "Travel Bureau" object with an indication of its methods: country of travel, duration of rest, date of departure, excursions (include or refuse), the cost of excursions, the cost of a tour ( excluding excursions), the number of tourists, the cost of travel. Implement the methods declared in the object.
Here is the code that I wrote following the tutorial:
type Turburo = object
country, date:string;
duration, ex_price, putevka, kol_tourists, total_price: integer;
ex: boolean;
procedure create;
end;
procedure Turburo.create;
var is_ex:integer;
begin
write('Страна: ');
readln(country);
write('Длительность отдыха: ');
readln(duration);
write('Дата отправления: ');
readln(date);
write('Включать экскурсии?(0-нет, 1-да):');
readln(is_ex);
if is_ex = 1 then begin
ex := true;
write('Стоимость экскурсии: ');
readln(ex_price);
end
else ex:=false;
write('Стоимость путевки(без учёта экскурсии): ');
readln(putevka);
write('Кол-во туристов: ');
readln(kol_tourists);
total_price:= ex_price + putevka;
write('Стоимость путешествия:', total_price);
end;
var tur:Turburo;
begin
tur.create;
end.
Answer the question
In order to leave comments, you need to log in
Because you have a newer pascal, not a turbo pascal.
You need to use the word class, not object
type Turburo = class
country, date:string;
duration, ex_price, putevka, kol_tourists, total_price: integer;
ex: boolean;
procedure create;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question