Parte de mi pregunta era si dentro de la propia clase se puede llamar a un método de clase de ella.
Código Delphi
[-]
unit Unit2_classMethod;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
private
procedure LeerDisco;
public
procedure Inicializar;
published
class procedure Crear();
class function Suma(x, y: integer): Integer;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
class function Suma(x, y: integer): Integer;
begin
result:= x+y;
end;
class procedure TForm2.Crear;
var
F:TForm2;
begin
F := TForm2.Create(nil);
try
F.Inicializar;
F.LeerDisco;
F.ShowModal;
finally
F.Free;
end;
end;
procedure TForm2.LeerDisco();
begin
MessageDlg('Leyendo de disco... La suma es: ' + IntToStr(Suma(4,5)), mtInformation, [mbOK], 0);
end;
procedure TForm2.Inicializar();
begin
MessageDlg('Inicializando...', mtInformation, [mbOK], 0);
end;
end.
Y luego desde otro punto de la apliación (otra unit):