unit Un_Abonent;

interface

type TAbonent=class
              FFIO:string[30];
              FAdress:record
                     street:string[20];
                     num_home:integer;
                     num_flat:integer
                     end;
              Fnumberphone:string[11];
              Fbalans:string;
              constructor Create (var t:TextFile);
              constructor Create_Read;
              constructor Create_numberphone;
              procedure Print;
              function compare(s:TAbonent):integer;//(Fnumberphone<>=obj)
              end;

implementation

  constructor TAbonent.Create;
  begin
    inherited Create; // объем памяти
    Readln(t,FFio);
    Readln(t,FAdress.street);
    Readln(t,FAdress.num_home);
    Readln(t,FAdress.num_flat);
    Readln(t,Fnumberphone);
    Readln(t,Fbalans);
    if not Eof(t) then Readln(t)//пропуск пустой строки
  end;

  constructor TAbonent.Create_Read;
  begin
    inherited Create;
    Readln(FFio);
    Readln(FAdress.street);
    Readln(FAdress.num_home);
    Readln(FAdress.num_flat);
    Readln(Fnumberphone);
    Readln(Fbalans);
  end; 

  constructor TAbonent.Create_numberphone;
  begin
    inherited Create;
    Readln(Fnumberphone)
  end;

  procedure TAbonent.Print;
  begin
    Writeln('ФИО=',FFIO);
    Writeln('Адрес=',' ул.',FAdress.street,' д.',FAdress.num_home,' кв.',FAdress.num_flat);
    Writeln('Номер телефона=',Fnumberphone);
    Writeln('Баланс=',Fbalans);
    Writeln('-------------------')
  end;

   function TAbonent.Compare;
  begin
    if Fnumberphone=s.Fnumberphone then result:=0
                                  else
    if Fnumberphone<s.Fnumberphone then result:=-1
                                   else result:=1;
  end;


end.

