Multiple functions with same name but different argument lists and return type. Examples of function overloading are
(type.1) : Same function name and return type but changing arguments list.
function ABC(arg1:integer) return integer is
begin
--- .... ---
end ABC;
function ABC(arg1:integer;arg2:string) return integer is
begin
--- .... ---
end ABC;
function ABC(arg1: integer;arg2: string;arg3: real) return integer is
begin
--- .... ---
end ABC;
(type.2) : Same function name and arguments list but different return types.
function ABC(arg1:integer) return integer is
begin
--- .... ---
end ABC;
function ABC(arg1:integer) return std_logic_vector is
begin
--- .... ---
end ABC;
function ABC(arg1: integer) return real is
begin
--- .... ---
end ABC;
(type.3) : Same function name but changing arguments list and return type.
function ABC(arg1:integer) return integer is
begin
--- .... ---
end ABC;
function ABC(arg1:integer;arg2:string) return std_logic_vector is
begin
--- .... ---
end ABC;
function ABC(arg1: integer;arg2: string;arg3: real) return real is
begin
--- .... ---
end ABC;
No comments:
Post a Comment