Doing a a simple demo. Can anyone think of any other places an attribute can go?
Doing a a simple demo. Can anyone think of any other places an attribute can go?
[Sample]
TAttributesEverywhere = class
private
[Sample] FSomeProperty: Extended;
procedure SetSomeProperty(const Value: Extended);
public
[Sample]
procedure DoThis([Sample]aParameter: string);
[Sample]
function DoThat([Sample]aParameter: TObject): integer;
[Sample]
property SomeProperty: Extended read FSomeProperty write SetSomeProperty;
end;
[Sample]
TAttributesEverywhere = class
private
[Sample] FSomeProperty: Extended;
procedure SetSomeProperty(const Value: Extended);
public
[Sample]
procedure DoThis([Sample]aParameter: string);
[Sample]
function DoThat([Sample]aParameter: TObject): integer;
[Sample]
property SomeProperty: Extended read FSomeProperty write SetSomeProperty;
end;
I should add "that isn't already being demonstrated."
ReplyDeleteGraeme Geldenhuys The what? There's documentation?? ;)
ReplyDeleteWell, you can have multiple attributes at each location, Nick Hodges.
ReplyDeleteMaybe add the attribute also in a derived class.
ReplyDelete+1 for check the Delphi Documentation
ReplyDeleteLook at this SO question, "Which language elements can be annotated using attributes language feature of Delphi?" :
ReplyDeletehttp://stackoverflow.com/q/6119986/576719
Awesome -- that SO answer is exactly what I was looking for.
ReplyDelete