program OOPtest;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
testclass = class (TObject)
procedure kill(a:integer); virtual; abstract;
end;
testdaughter = class (Testclass)
procedure kill(a:integer); overload;
end;
testson = class (Testclass)
procedure kill(a:integer); overload;
end;
procedure testson.kill(a:integer);
begin
write(a-1);
end;
procedure testdaughter.kill(a:integer);
begin
write(a+1);
end;
var arr : array [1..2] of testclass;
var a : integer;
var s : testson;
var d : testdaughter;
begin
a:=2;
arr[1]:=s;
arr[1]:=testson.Create;
arr[1].kill(a);
readln;
end.
Сообщение отредактировано: Reflex -