Delphi: writing to the private ancestor's field in descendant class
问题 I need to fix a third-party component. This component's class has private variable which is actively used by its descendants: TThirdPartyComponentBase = class private FSomeVar: Integer; public ... end; TThirdPartyComponent = class (TThirdPartyComponentBase) protected procedure Foo; virtual; end; procedure TThirdPartyComponent.Foo; begin FSomeVar := 1; // ACCESSING PRIVATE FIELD! end; This works because both classes are in the same unit, so they're kinda "friends". But if I'll try to create a