44 lines
1012 B
Ada
44 lines
1012 B
Ada
|
with persons;
|
||
|
with poles;
|
||
|
with workers;
|
||
|
with Ada.Text_IO;
|
||
|
with Ada.Strings.Unbounded;
|
||
|
with persons; use persons;
|
||
|
with poles; use poles;
|
||
|
with workers; use workers;
|
||
|
|
||
|
procedure classes is
|
||
|
package to renames Ada.Text_IO;
|
||
|
package su renames Ada.Strings.Unbounded;
|
||
|
|
||
|
type person_access is access all person'Class;
|
||
|
type persons_vector is array (Positive range <>) of Person_Access;
|
||
|
|
||
|
p1: aliased person;
|
||
|
p2: aliased pole;
|
||
|
w : aliased worker;
|
||
|
x: su.Unbounded_String;
|
||
|
vec: persons_vector (1 .. 3);
|
||
|
begin
|
||
|
p1.set_name(su.To_Unbounded_String("Ala"));
|
||
|
x := p1.get_name;
|
||
|
to.Put("Nazwa: ");
|
||
|
to.Put(su.To_String(x));
|
||
|
to.New_Line;
|
||
|
|
||
|
p2.set_name(su.To_Unbounded_String("Tomek"));
|
||
|
p2.set_pesel(su.To_Unbounded_String("90123104479"));
|
||
|
|
||
|
w.set_name(su.To_Unbounded_String("Worker 1"));
|
||
|
w.set_salary(1500.01);
|
||
|
|
||
|
vec(1) := p1'Access;
|
||
|
vec(2) := p2'Access;
|
||
|
vec(3) := w'Access;
|
||
|
|
||
|
for id in vec'Range loop
|
||
|
vec(id).greet;
|
||
|
end loop;
|
||
|
|
||
|
end classes;
|