Reputation: 2320
How can I write two functions with the same name with different parameter types like this:
public
{ Public declarations }
function MsgW(const Msg:String):Integer;
function MsgW(const Msg:String;title:String):Integer;
function MsgW(const Msg:String;title:String):Integer;
Begin
Result := MessageboxW(0,Pchar(Msg),Pchar(title),MB_OK);
End;
function MsgW(const Msg:String):Integer;
Begin
Result := MessageboxW(0,Pchar(Msg),'MessageBoxW',MB_OK);
End;
Upvotes: 3
Views: 779
Reputation: 28516
Use overload
directive
function MsgW(const Msg:String):Integer; overload;
function MsgW(const Msg:String;title:String):Integer; overload;
Upvotes: 12