Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
44
Task/Classes/Delphi/classes.pas
Normal file
44
Task/Classes/Delphi/classes.pas
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
program SampleClass;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
type
|
||||
TMyClass = class
|
||||
private
|
||||
FSomeField: Integer; // by convention, fields are usually private and exposed as properties
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure SomeMethod;
|
||||
property SomeField: Integer read FSomeField write FSomeField;
|
||||
end;
|
||||
|
||||
constructor TMyClass.Create;
|
||||
begin
|
||||
FSomeField := -1
|
||||
end;
|
||||
|
||||
destructor TMyClass.Destroy;
|
||||
begin
|
||||
// free resources, etc
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TMyClass.SomeMethod;
|
||||
begin
|
||||
// do something
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
lMyClass: TMyClass;
|
||||
begin
|
||||
lMyClass := TMyClass.Create;
|
||||
try
|
||||
lMyClass.SomeField := 99;
|
||||
lMyClass.SomeMethod();
|
||||
finally
|
||||
lMyClass.Free;
|
||||
end;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue