Ich habe hier einen Sachverhalt, den ich so nicht ganz verstehe...
[quote=Language-Reference-Guide]Private
All fields and methods that are in a private block, can only be accessed in the module (i.e. unit or program) that contains the object definition. They can be accessed from inside the object’s methods or from outside them e.g. from other objects’ methods, or global functions.
Protected
Is the same as Private, except that the members of a Protected section are also accessible to descendent types, even if they are implemented in other modules.
Public
fields and methods are always accessible, from everywhere. Fields and methods in a public section behave as though they were part of an ordinary record type.[/quote]
Demnach wäre ein Feld, das als private deklariert ist, in einem anderen Modul nicht sichtbar - auch nicht von einer abgeleiteten Klasse.
Jetzt habe ich aber etwas ausprobiert:
Code: Alles auswählen
unit contnrs;
...
TOrderedList = class(TObject)
private
FList: TList;
...
end;
...
Code: Alles auswählen
unit myunit;
uses contnrs;
type
TPublicQueueList = class(TQueue)
public
property List: TList read FList;
end;
...
Habe ich jetzt einfach etwas nicht richtig verstanden, oder bezieht sich das nicht sichtbar nur auf die Implementation (und nicht auch auf die Deklaration)?
Bitte um Aufklärung.