delphi - Function of a class returning an array that is declared after the class -
i somehow haven't dealt problem before. have class
troom = class private width, length, x1,x2,y1,y2, index: integer; public function draw: roomarr; procedure setparam; function getparam: integer; end;
now, below that, because delphi 7 can't return arrays of tclass, have declared this:
roomarr = array of troom;
this somehow fixes problem. no idea why, found solution on internet
i using "roomarr" in other functions , works fine, expected. array declared after class (otherwise not know class troom), troom (more precisely function "draw") cannot use it.
is there way bypass problem?
thanks in advance.
a forward declaration of troom
:
type troom = class; // forward declaration roomarr = array of troom; troom = class ... function draw: roomarr; end;
the forward declaration must completed in same type section.
Comments
Post a Comment