As the question says... is it possible to declare the read/write of a property at different level of visibility. If so, what would be the syntax?
Something along the line of :
protected
property MyProp : Integer write FMyProp;
public
property MyProp : Integer read FMyProp;
end;
Not that it would be a major language feature, it's easily replaced by
protected
procedure SetMyProp(Value : Integer);
public
property MyProp : Integer read FMyProp;
end;
I'm just curious if such a possibility exists.
No, you have to split it into two separate properties (with different names), although they can refer to the same private field.
No, this isn't possible. I'm not sure why you would need to do that, however.
The only reason I can see is to make it read-only while still allowing it to be published and seen in the Object Inspector, and you can already do this:
private
procedure SetMyProp(Value: String);
published
MyProp: string read FMyProp write SetMyProp;
...
procedure TMyComponent.SetMyProp(Value: String);
begin
//
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With