code-examples/2015/2015_03/ada/algorytmy/derived.adb

31 lines
589 B
Ada

with Ada.Integer_Text_IO;
with Ada.Text_IO;
procedure derived is
package io renames Ada.Integer_Text_IO;
package to renames Ada.Text_IO;
package objects is
type Integer_1 is range 1 .. 10;
procedure print(x: Integer_1);
type Integer_2 is new Integer_1 range 8 .. 10;
end objects;
package body objects is
procedure print(x: Integer_1) is
begin
io.Put(Integer(x), Width => 0);
to.New_Line;
end print;
end objects;
x: objects.Integer_2 := 9;
begin
objects.print(x);
end derived;