Comment déclaration de type function of object
Bonjour à tous
Je souhaite standardiser à priori l'appel pour une série de fonctions... Mais ça ne marche pas... J'ai des erreurs, j'ai déjà réussi à le faire mais j'ai oublié comment...
Façon 1:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| type fFunctionMAJ:function (Symbole:string):boolean of object;
Mon_Objet=class
function MAJ:fFunctionMAJ;
end;
implementation
var Functions_MAJ:array[0..1] of fFunctionMAJ;
function Mon_Objet.MAJ:fFunctionMAJ;
begin
result:=false;//[dcc32 Erreur] Unit1.pas(3013): E2010 Types incompatibles : 'fFonction_MAJ' et 'Boolean'
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
aFunction_MAJ[0]:=Mon_Objet.Maj;//[dcc32 Erreur] Unit1.pas(3618): E2010 Types incompatibles : 'Boolean' et 'fFonction_MAJ'
end; |
Façon 2:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| type fFunctionMAJ:function (Symbole:string):boolean of object;
Mon_Objet=class
function MAJ(Symbole:string):boolean ;
end;
implementation
var Functions_MAJ:array[0..1] of fFunctionMAJ;
function Mon_Objet.MAJ(Symbole:string):boolean;
begin
result:=false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
aFunction_MAJ[0]:=Mon_Objet.Maj;// [dcc32 Erreur] Unit1.pas(3618): E2010 Types incompatibles : 'fFonction_MAJ' et 'Procedure'
end; |
Merci d'avance pour votre aide