Surcharge de constructeurs
Bonjour,
J'essaie de surcharger mon constructor "Create", mais j'ai l'erreur
Citation:
main.pas(16,23) Error: identifier idents no member "Create"
main.pas(16,23) Fatal: Syntax error, ";" expected but "identifier CREATE" found
Fatal: Compilation aborted
Voilà l'interface de ma classe :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| type TSprite = class
public
constructor Create(X, Y : integer; Path : PChar);
constructor Create(var Pos : TSDL_Rect; Path : PChar);
constructor Create(X, Y : integer; Img : PSDL_Surface);
constructor Create(var Pos : TSDL_Rect; Img : PSDL_Surface);
procedure Apply(Screen : PSDL_Surface);
function GetPosition : TSDL_Rect;
function GetImg : PSDL_Surface;
procedure SetPosition(var NewPos : TSDL_Rect);
procedure SetPosition(x, y : integer);
private
m_Position : TSDL_Rect;
m_Img : PSDL_Surface;
end; |
Puis mon appel dans le main :
Code:
1 2 3 4 5 6 7 8 9
|
procedure MainLoop(Screen : PSDL_Surface);
var
Event : TSDL_Event;
Sprite : TSprite;
begin
Sprite := TSprite.Create(0, 0, 'rollBig.gif');
...
end; |
Merci d'avance :ccool: