Там далеко все не так просто. Скажем вот примерно такой базовый класс Организм:
Код:
TOrganizm = class
private
fName: String; // Собственно что за тварь
fSpeed: Integer; // Максимальная скорость ее передвижения по миру
fOld: Integer; //Текущий возраст - задается в днях
fStartReproduction: Integer; // Когда она это самое могет
fFinishReproduction: Integer; // Когда она уже это самое не может и грустит
fMaxOld: Integer; //Максимальный возраст после которого грабки отбрасывает
fMaxChilds: Integer; //Сколько потомков может настругать когда могет это самое
public
property Name: String read fName write fName;
property Speed: Integer read fSpeed write fSpeed default 0;
property Old: Integer read fOld write fOld default 0;
property StartReproduction: Integer read fStartReproduction write fStartReproduction;
property FinishReproduction: Integer read fFinishReproduction write fFinishReproduction;
property MaxOld: Integer read fMaxOld write fMaxOld;
property MaxChilds: Integer read fMaxChilds write fMaxChilds;
end;
и описание так будет:
Код:
with TOrganizm.Create
do begin
Name := 'Трава';
Speed := 0;
StartReproduction := 10;
FinishReproduction := 20;
MaxOld := 40;
MaxChilds := 20;
end;
with TOrganizm.Create
do begin
Name := 'Кролик';
Speed := 3;
StartReproduction := 90;
FinishReproduction := 720;
MaxOld := 900;
MaxChilds := 6;
end;
А вот как задать кто кого кушает и при каких обстоятельствах я что-то не соображу.
