如何实现在先声明的类里面调用后声明的类。如
unit xxxx;interfacetype
a = class
private
public
function Getb(): b;//问题处
end;type
b = class
private
public
end;
...............................
不能改变所在的UNIT和声明先后顺序,请问各位大狭能否做到。
unit xxxx;interfacetype
a = class
private
public
function Getb(): b;//问题处
end;type
b = class
private
public
end;
...............................
不能改变所在的UNIT和声明先后顺序,请问各位大狭能否做到。
Forward declarations allow mutually dependent classes. For example,type TFigure = class; // forward declaration
TDrawing = class
Figure: TFigure;
...
end; TFigure = class // defining declaration Drawing: TDrawing;
...
end;Do not confuse forward declarations with complete declarations of types that derive from TObject without declaring any class members.type TFirstClass = class; // this is a forward declaration TSecondClass = class // this is a complete class declaration end; // TThirdClass = class(TObject); // this is a complete class declaration
b = class; a = class
private
public
function Getb(): b;
end; b = class
private
public
end;