tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
77
Task/Polymorphism/Ada/polymorphism-2.ada
Normal file
77
Task/Polymorphism/Ada/polymorphism-2.ada
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
|
||||
package body Shapes is
|
||||
|
||||
-----------
|
||||
-- Print --
|
||||
-----------
|
||||
|
||||
procedure Print (Item : in Point) is
|
||||
begin
|
||||
Put_line("Point");
|
||||
end Print;
|
||||
|
||||
----------
|
||||
-- Setx --
|
||||
----------
|
||||
|
||||
function Setx (Item : in Point; Val : Integer) return Point is
|
||||
begin
|
||||
return (Val, Item.Y);
|
||||
end Setx;
|
||||
|
||||
----------
|
||||
-- Sety --
|
||||
----------
|
||||
|
||||
function Sety (Item : in Point; Val : Integer) return Point is
|
||||
begin
|
||||
return (Item.X, Val);
|
||||
end Sety;
|
||||
|
||||
----------
|
||||
-- Getx --
|
||||
----------
|
||||
|
||||
function Getx (Item : in Point) return Integer is
|
||||
begin
|
||||
return Item.X;
|
||||
end Getx;
|
||||
|
||||
----------
|
||||
-- Gety --
|
||||
----------
|
||||
|
||||
function Gety (Item : in Point) return Integer is
|
||||
begin
|
||||
return Item.Y;
|
||||
end Gety;
|
||||
|
||||
------------
|
||||
-- Create --
|
||||
------------
|
||||
|
||||
function Create return Point is
|
||||
begin
|
||||
return (0, 0);
|
||||
end Create;
|
||||
|
||||
------------
|
||||
-- Create --
|
||||
------------
|
||||
|
||||
function Create (X : Integer) return Point is
|
||||
begin
|
||||
return (X, 0);
|
||||
end Create;
|
||||
|
||||
------------
|
||||
-- Create --
|
||||
------------
|
||||
|
||||
function Create (X, Y : Integer) return Point is
|
||||
begin
|
||||
return (X, Y);
|
||||
end Create;
|
||||
|
||||
end Shapes;
|
||||
Loading…
Add table
Add a link
Reference in a new issue