On 27.01.2012 22:46, Mark Morgan Lloyd wrote:
If a class has a public reader property like this:

TLexemeList= class(TObject)
protected
fValue: TPrimaevalValue;
public
property Value: TPrimaevalValue read fValue;
...

is there a way of allowing a class helper to augment this with a
protected writer property? My attempt as below messed up the reader:

TLLEvaluator = class helper for TLexemeList
private
procedure SetValue(v: TPrimaevalValue);
protected
property Value: TPrimaevalValue write SetValue;
...


In your exact example fValue is protected so the following should work:

property Value: TPrimaevalValue read fValue write SetValue;

Another possibility (for non protected properties):

property Value: TPrimaevalValue read GetValue write SetValue;

...

function TLLEvaluator.GetValue: TPrimaevalValue;
begin
  Result := inherited Value;
end;

Other possibilities don't exist, as a helper's declaration will hide the declaration of the extended class (exceptions are methods with "overload" defined).

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to