102. 덧셈 연산자를 다시 불러와 기록 유형에 작용한다

with Ada.Text_IO,Ada.Integer_Text_IO;
use Ada.Text_IO,Ada.Integer_Text_IO;

procedure Infix is
   
   type THREE_INTS is
      record
         Length,Height,Width:Integer;
      end record;
   
   Big,Medium,Sum:THREE_INTS;
   
   function "+"(Record1,Record2:THREE_INTS)return THREE_INTS is
      Temp:THREE_INTS;
   begin
      Temp.Length:=Record1.Length+Record2.Length;
      Temp.Height:=Record1.Height+Record2.Height;
      Temp.Width:=Record1.Width+Record2.Width;
      return Temp;
   end "+";
   
begin
   Big.Length:=10+2;
   Big.Height:=22;
   Big.Width:=17;
   Medium.Length:=5;
   Medium.Height:=7;
   Medium.Width:=4;
   Sum:=Big+Medium;
   Put("The sum is:");
   Put(Sum.Length,4);
   Put(Sum.Height,4);
   Put(Sum.Width,4);
   New_Line;
end Infix;

좋은 웹페이지 즐겨찾기