-- A simple example showing a pointer to a record type
with ada.text_io; use ada.text_io; 
with ada.integer_text_io; use ada.integer_text_io; 
 
procedure boxptrexample1  is 

    type Box is record
        l, w: Integer := 0;
    end record;

    procedure put_line(aBox: Box) is
    begin
        put(aBox.l);
        put(aBox.w);
        new_line;
    end put_line;

    -- A type for pointers to boxes
    type BoxPtr is access Box;

    b1: Box;

    p1: BoxPtr;

begin
    b1 := (11, 22);

    p1 := new Box;

    p1.all := (33, 44);

    put_line(b1);
    put_line(p1.all);

    if b1 = p1.all then
        put_line("Same");
    else
        put_line("Different");
    end if;

    b1 := p1.all;

    put_line(b1);
    put_line(p1.all);

    p1.all.l := 55;
    p1.all.w := 66;

    put_line(p1.all);

end boxptrexample1;