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

28 lines
646 B
Ada

package body persons is
function get_name(This: person) return su.Unbounded_String is
begin
return This.name;
end get_name;
procedure set_name(This: out person; val: su.Unbounded_String) is
begin
This.name := val;
end set_name;
procedure greet(This: person) is
name: String := su.To_String(This.get_name);
begin
if This in person then
to.Put_Line("Person type");
end if;
if This in person'Class then
to.Put_Line("Person'Clas type");
end if;
to.Put("Greets from person ");
to.Put_Line(name);
end;
end persons;