初用delphi,怎样调用.pas 中的函数 和 pas中函数格式的写法,看看我的错在那里?

irians 2003-02-17 06:07:09
//下面是我写的pas
//文件名 func1.pas
unit func1;

interface
type
public
function msgfunc(s:string):string;
end;
implementation
//------------------------------------------------------
function msgfunc(s:string):string;
begin
Result:='this is come from a pas file';
end;
//------------------------------------------------------
end.

//还有,然后该怎么调用。是否 use里填加func1 ,然后就可以使用函数msgfunc了?
...全文
493 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
irians 2003-02-17
  • 打赏
  • 举报
回复
谢谢3位,结贴了。
irians 2003-02-17
  • 打赏
  • 举报
回复
谢谢3位,结贴了。
richard_ouyang 2003-02-17
  • 打赏
  • 举报
回复
在其他单元引用该单元,然后直接引用该过程,但是当前单元中的函数名称不能和被引用单元的函数一致。否则采用
func1.msgfunc(s);
CloneCenter 2003-02-17
  • 打赏
  • 举报
回复
type 是定义类型,不需要放在你的函数的前面。
wisenowa 2003-02-17
  • 打赏
  • 举报
回复
只要引用该单元

直接调用就可以了
wisenowa 2003-02-17
  • 打赏
  • 举报
回复
unit func1;

interface

function msgfunc(s:string):string;

implementation
//------------------------------------------------------
function msgfunc(s:string):string;
begin
Result:='this is come from a pas file';
end;
//------------------------------------------------------
end.

5,927

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧