I have an object that produces two of it's own kind on prompt.
The method that does this is a function that must return them.
Function can only return one item, so I decided on an array to do it.
The only way I could see was to declare the array type first and then use it as the return type but the chicken and egg problem arose.
Type
TItemArray=array[1..2] of TBalloon;
TBalloon=Class(TObject)
Private
;
public
function TBalloon.MakeTwoMore(Avalue: integer): TItemArray;
implementation
function TBalloon.MakeTwoMore(AValue: Integer): TItemArray;
begin
result[1]:=TBalloon.create(5);
result[2]:=TBalloon.create(9);
end;
Of course, TItemArray knows nothing of TBalloon, not yet declared.
If I Place TItemArray declaration after TBalloon declaration then the function knows nothing of TItemArray.
Can somebody please point me in the right direction.
Regards
The method that does this is a function that must return them.
Function can only return one item, so I decided on an array to do it.
The only way I could see was to declare the array type first and then use it as the return type but the chicken and egg problem arose.
Type
TItemArray=array[1..2] of TBalloon;
TBalloon=Class(TObject)
Private
;
public
function TBalloon.MakeTwoMore(Avalue: integer): TItemArray;
implementation
function TBalloon.MakeTwoMore(AValue: Integer): TItemArray;
begin
result[1]:=TBalloon.create(5);
result[2]:=TBalloon.create(9);
end;
Of course, TItemArray knows nothing of TBalloon, not yet declared.
If I Place TItemArray declaration after TBalloon declaration then the function knows nothing of TItemArray.
Can somebody please point me in the right direction.
Regards