This question has already been answered:
We have two classes in different modules:
Unit uClassA; Interface Type TClassA = Class(TObject) Private FBlocks: Array Of TBlock; Function FGetBlock(Value: Byte): TBlock; Public ClassB: TClassB; Property Block[Index: Byte]: TBlock Read FGetBlock; End; Implementation End. and ClassB, which is created in the ClassA constructor, after filling the FBlocks array
Unit uClassB; Interface Type TClassB = Class(TObject) Public Procedure SetBlock(); End; Implementation Procedure TClassB.SetBlock(); Begin //Тут нужно достучаться до ClassA.Block[Index] End; End. How to organize it more correctly? It only comes to mind to make an empty class with this array and inherit both from it, but is this correct?
SetBlock? - VTTTClassBfield such asOwner: TClassAand pass a pointer to the parent object in the constructor. - dr. FINTClassAandTClassB will refer. In this module, describe theIClassAinterface with the necessary methods and implement this interface inTClassA. In the constructor, pass the link to the interface. - dr. FIN