如何用不同的参数类型编写两个具有相同名称的函数,如下所示:
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;
Run Code Online (Sandbox Code Playgroud)
Dal*_*kar 11
使用overload指令
function MsgW(const Msg:String):Integer; overload;
function MsgW(const Msg:String;title:String):Integer; overload;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
218 次 |
| 最近记录: |