unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons; type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject); private
Function Maxi(i,y:integer):integer;overload;
Function Maxi(i,x,y:integer):integer;overload;
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm}
Function TForm1.Maxi(i,y:integer):integer;
begin
if i>y then Result:=i else Result:=y;
end; Function TForm1.Maxi(i,x,y:integer):integer;
Var
s:integer;
begin
if i>y then s:=i else s:=y;
if s>x then Result:=s else Result:=x;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Showmessage('10和12的最大值是:'+INTTOSTR(maxi(,)));
end; procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
Showmessage('10和12,15的最大值是:'+INTTOSTR(maxi(,,)));
end; end.

重载:可以通相同的名字,但不同的参数声明多个例程,来重载一个例程名称.为了声明重载例程,使用overload指令.

最新文章

  1. DB监控-redis监控
  2. JS~json日期格式化
  3. TinyXML 在vs2010 VC++使用
  4. Python File.readlines() 方法
  5. css3图片墙
  6. 张江在线APP演示
  7. 【递推】地铁重组(subway) 解题报告
  8. TexturePacker文件的反向解析-TextureUnpacker
  9. C++ typeid实现原理
  10. django+Python数据库利用Echarts实现网页动态数据显示
  11. 用Open SSH生成公钥和私钥(Win)
  12. golang 实现HTTP代理和反向代理
  13. asp.net core系列 26 EF模型配置(实体关系)
  14. 133. leetcode-Clone Graph
  15. 用函数SendARP()获取局域网计算机的MAC地址
  16. [JZOJ5836] Sequence
  17. (原创)odoo关系字段在视图中的行为控制 总结
  18. 解决因为本地代码和远程代码冲突,导致git pull无法拉取远程代码的问题
  19. 个人作业-Week 2
  20. redis 慢查询日志

热门文章

  1. 64位MATLAB和C混合编程以及联合调试
  2. 详解Struts1.x的运行机制及命名规则
  3. MySQL代码备份
  4. 爬虫入门之urllib库详解(二)
  5. ASP.NET中引用dll“找不到指定模块"的完美解决办法 z
  6. MFC 鼠标事件
  7. Scrum第一次冲刺
  8. Android(java)学习笔记23:finally关键字的作用
  9. cftool拟合&函数逼近
  10. 【[HAOI2016]找相同字符】