unit Un_company;

interface
 uses Un_list, Un_Abonent;

 type TCompany=class
              public
               FName:string;
               FL:TList;
               constructor Create (file_name:string);
               destructor Destroy; override;
               procedure Print;
               procedure Add(S:TInfo);
               procedure Del_ab(N:TInfo);
               function compare1(s:TCompany):integer;
             end;

implementation

  constructor TCompany.Create;
  begin
    inherited Create;
    FName:=CreateL(file_name,FL)
  end;

  procedure TCompany.add;
  begin
    if add_Abonent(FL,s) then Writeln('Такой номер уже зарегистрирован!')
                         else
                         begin
                            Add_Order(FL,s);
                            Print
                         end
  end;

  destructor TCompany.Destroy;
  begin
    ClearL(FL);
    inherited Destroy
  end;

  procedure TCompany.Print;
  begin
    writeln(FName,':');
    PrintL(FL)
  end;

  procedure TCompany.Del_ab;
  begin
   if not Del(FL,N) then Writeln ('Такой номер не найден!') else print;
  end;

  function TCompany.Compare1;
  begin
    if FName=s.Fname then result:=0
                                  else
    if Fname<s.Fname then result:=-1
                                   else result:=1;
  end;

end.
