I'm a Java developer and I always use the getter-setter methods.
How can I use this concept in Delphi?
- I define a local variable
//1
- I create a property
//2
- I press CTRL+SHIFT+C and the editor creates the getter and setter methods
//3
for this example:
unit Unit1;
type
ClassePippo=class
private
colorText:string; //1
function getColorText: String; //3
procedure setColorText(const Value: String); //3
public
property colore: String read getColorText write setColorText; //2
end;
implementation
{ ClassePippo }
function ClassePippo.getColorText: String; //3
begin
Result:=colorText;
end;
procedure ClassePippo.setColorText(const Value: String); //3
begin
colorText:=Value;
end;
end.
Is there a feature to auto-create the getter and setter methods?
I only want to write colorText: string; //1
and invoke a shortcut and I want that the IDE auto-creates //2
and //3
.
(When I develop in Java using Eclipse I can auto-generate the getter and setter methods using Source-->Generate getter and setter...)