    Object Pascal:   

     4 

    .  


     

         ,      
       . 

      

               
           . 

        

             . 

      

         ,   Delphi. 

      

       ,    Object Pascal   Delphi. 


      Pascal,      , 
      .   
  ,       , 
  .       , 
          ,  
   .      .  
    ,    . 
  ,      . 
 ,          . 
         .      
   ,    Pascal  
        . 
-      ,   
          
.    ,     .     
.  -  ,     
 ,     .      
     ,    . 
       ,       
  ,        .  
         
        .  
  (unit),   ,    , 
  .        
  .      
  .      

82

       :   
     .    Object 
Pascal,         . 
-  ;    ;   ,   
    .   
          
 (    : 
- .  . .}.   
    ,       
 Pascal    . ,  
 ,        Pascal. 
      Delphi     Object Pascal,  
   ,   . 
                
   .     Pascal,  
  .     
,      ,  . 
     -   .     
  .        
 . 

     

     Object Pascal      Delphi. , 
        ,      
      ,      
  ,   . 
       ,     3, "Object Pascal: 
 ",       .   record, 
 class      (). ,  , 
   .      . 
  .     .   
         class. 
          .  
          
,  . 

         

     		  record,     
     		       
     	,   ,  ,   
			,   

        ,  class    . 
        . 
Object Pascal      .  
,         var, 
     . 

     

    type TMyClass = class //   
	(THeritage)  //    
    public { private, protected, published)         //  
    afield: atype; //  
    procedure AMethod( Parm: AType );  //  
	{"", virtual, dynamic, message, abstract, override} 
    property Aproperty: atype read afield write amethod; 
    //  
    class procedure AClassMethod;  //   
    end; 

           class,  
    . 
         .  ,  
   ,    : 
   ,   .    
   ,        
  ().       
.      ,   
.       . 
        .   
Object Pascal       
 . , ,  ,    
     ,       
 . 

     4. Object Pascal:   83 

            .  
     .    
 ,   .    , 
   .       , 
,   ,   ,      
  .  ,   . 
      ()    
.      .  , 
     .  ,   -, 
. 
     Object Pascal      TObject    
   .        
,   TObject.      System  
  ,    TObject. , 
     . 
             
-.       
         . 
        -.  
   . 

    type TThing = class 
	...
    end; 
    TAnimal = class(TThing) 
	...
    end; 
    TMammal = class(TAnimal) 
	...
    end; 
    TVegetable = class(TThing) 
	...
    end; 
    TTree = class(TVegetable) 
	...
    end; 

      TAnimal    TAnimal, TThing  
TObject.  TThing    TThing, TAnimal, TMammal, 
TTree     TThing.    TTree 
 TMammal .    TThing   
  TTree,   ,   TThing, 
 TMammal   . 

      

           .  
   : private, protected, public  published.  
         
.  ,     ,   . 
        ,    , 
         
.          
,    . 
            . 
        ,    
  .  ,    ,   
 .     . 

     
        C++    public, 
protected  private.        
Object Pascal,   .  ,  Object Pascal , 
   ,       public. 


    Private 

        .  ,    
, ,  private,   . 
      private  ,    
         
   ,     
    .     
,        ,   
private,      .     
     .                 
                                                                               
    84  I.   


    Protected 

     ,    private,   .  
,     ,  ,    
protected,    -   .  - 
 ,    ,      private. 
       -,    
  .  ,   
-,     ,    
      . 

    Public 

    ,   public,  ,    .  
     . 

    Published 

      published       
(Runtime Type Information  RTTI),   ,   ,  
 published-.        
 ,       ,   . 
        ,  published,   
  public.  ,  published,    
,     .   ,  
published  public,   ,   published-   
,  published,    . 
     Delphi, , published-     
   (Object Inspector),  , 
         .  
   (Visual Component Library  VCL)  
         
         . 
       published   . 
    1.       published   ,   
         
    .   RTTI  
  $. 
    2.    ,    published,    
.        public, protected  
private.       
    3.   ,  published,    ,   
 ,  ( Real),  ,   
,      (    ). 
      ,     
     .     
   . 
           .  
    published. ,  
 ""    Delphi   (   
 ),       
  . 

     

           ,   . 
    ,        
   . 
         .  ()   
  ( ,   )    ,  
     .    forward 
    .      , 
     .     
     ,     
  ,     ,    . 

    procedure TMyClass.AMethod( Parml: Atype); begin 
    end;    {   AMethod   } 

          ,   
       .   
      . 
     ,     ,  
  inherited. 

     4. Object Pascal:   85 

             
  ,      .  
  self,      
,    .      
    .  self   
      . 
         .  ,   
     .    
 ,   . 4.1. 

     4.1.   

     	 

    Virtual 	      
    Dynamic 	      
    Message 	     
    Abstract 	          
    Override 	        
    Class 		     Self
                                                                               
             .  
      .   
,      . 

    Static 

      ,    ,  . 
   .        
      .   
,     ,   .   
   AnObject.AStaticMethod,  AnObject  
 AClassType,     
AClassType.AStaticMethod   AStaticMethod,   
AClassType. ,  AnObject      
,   AClassType,      
AStaticMethod.         
.    AClassType.AStaticMethod. 

    Virtual 

        ,    ,  
        .  
   .    ,   
     virtual. 
             
  ,   ,    .  
 ,   -,    
,     (override).     
 .        
   ,  override,   
.         
,    ().     
,     .    virtual 
  override. 
      override     
 .   -      
,   ,    override,    
 ,  . 
         AnObject.AVirtualMethod,  , 
 AVirtualMethod     ,    
AClassType.       
AClassType.AVirtualMethod,    AVirtualMethod,  
  ,    . 

    Dynamic 

     dynamic        
virtual.           
  .       
  . 

    86  I.   

         .   
    ,     
.      ,  
   .
     ,     ,  
    (   ).  
      -,   
   ,   
 . 

    Message 

           . 
    ,     
message,      .   
     .    
   . 
             
  . 
           . 
            . 
            . 
        ,     
,    .    
   ,      
,      .   message 
   (         
 ).  ,      
  var. 
            
 Windows    Delphi,    
.        
  Windows.     
    : 

    Procedure  Handle_WM_Paint_Message(var Msglnfo); message WM_PAINT; 

            .  
          .  
 ,    message.     
  ,      var     
 .     ,     
Handle_WM_Paint_Message,     WM_PAINT, 
  , .        
   : 

    Procedure Paint_It_This_Way(var AMessage: TWMPaint); message WM_PAINT; 

            
.     ,    
   Dispatch (var Message),    TObject. 
     TObject.Dispatch       
     ,    . 
     ,     
 .  Dispatch    ,   
 ,  Windows,    
. 
            
    .     
 . TObject.Dispatch    ,  
  ,   .    
     ,    -, 
 .. 
     TObject.Dispatch  ,     
   . , ,  ,   
   .       
, TObject.Dispatch   DefultHandler . 
            
 .        
     .     
   ,        .  
    inherited. 
     Paint_It_This_Way, ,     
 . 

    procedure  Paint_It_This_Way(var AMessage: TWMPaint); 
    begin 
      with AMessage  do 
        begin 
          ...   //        , 
          inherited;   //   TMyAncestor.Handle_WM_Paint_Message (AMessage). 


     4. Object Pascal:   87 


         ...//    . 
        end; 
    end; 

         ,     
     .       
    WM_PAINT,  DefultHandler. 

    Abstract 

    ,      ,  
         
.      ,    
         .  
  ,   .    
  ,     
 abstract, ,     : 

    type 
      TMYParent = class 
       procedure AMethod; virtual; abstract; 
       end; 
     TMYClass = class(TMYParent) 
       procedure AMethod; override; 
       end; 

    procedure TMYClass.AMethod; 
    begin 
      ... //  
    end; 

             ,  
      .   
    .     
  ,   Abstract, 
    . 
        ,  
     ,   .   
  :      
-.         . 

    Override 

     override      
.   . 

    type 
      TMYParent = class 
        procedure AMethod; virtual; abstract; 
      end; 
      TMYClass  =  class(TMYParent) 
        procedure AMethod; override; 
      end; 

        (TMYParent  TMYClass)   .  
TMYParent.AMethod  TMYClass.AMethod    .  
TMYParent (. )     TMYParent  TMYClass: 

    Var AnObject: TMYParent; 

       AnObject.AMethod  TMYParent.AMethod  
TMYClass.AMethod.      ,   
  AnObject. 
            ,   
override.         , 
     .     , 
      . 
       ,    .  
  ,       override,   
dynamic  virtual.      . 
  . 

    type 
      TMYOtherClass = class(TMYParent) 
         procedure AMethod; virtual; 
	end; 


    88  I.   

         AMethod    , 
 -    ,    .  
TMYOtherClass ( )     AMethod,    
      .   TMyParent 
           
TMyParent.AMethod. 

      

            
 .    ,   ,  
     . ,   
  class,      ,  
     ,        
.     .      
  ,      . 
       ,     procedure  
function,     ,   
 class.      ,  , 
    (). 
          Self    
     ,   ,    
.      .   
  class   Self   .  
     ,      . 
  -    ,    . 
   Self        . 
      ,   .   
    (, TMyClass.AClassMetod)   
(AnObject.AClassMetod). 

      

             
,     ,    
  .     
 ,       
.        , 
          
  . 
    Delphi      . 
      is  as.    
        
  . 

    Is  As 

      is ,       
    . ,    , 
 True,   AnObject     
 TMyClass     : 

    AnObject is TMyClass 

    , ,    True,  AnObject 
       TMyClass. 
       is     .     
  .      
  as: 

    With AnObject as TMyClass do... 

            
 : 

    With TMyClass(AnObject)  do... 

      as        
is.   ,     
EInvalidCast.  ,   as     
    .      
  . 

    if AnObject is TObjectType then 
       with TObjectType(AnObject) do... 
    else 
       raise EInvalidCast.Create('  '); 


     4. Object Pascal:   89 


       

             . 
    ,    ,  
    .   
   :     . 
             
 .          . 
        .   
 Pascal   ,     
   (Ord (X)  Chr (X)). Ord ( X)    
   Integer, a Chr (X)      Char. 
          
,    .    - , 
   . Integer (X)    
  , a Char (X)     
    char. 
            ,   
     ,    ,    
   .   ,    
 ,    -.    
 ,      ,   
    . 
             . 
     -,    
   . 

        

       Pascal       
         .  
       .  Object Pascal 
            
  : 

    Class of TMyClass 

               
  .          ,  
  ( ),    ,    
  .        , 
        . 
               
       .    
      ,   ,  
. ,  ,         
  .         
    .      
   ,     
 .      ,  
      ,  ,    
.  ,    as  is   
 ,    ,  . 
      . 

    type 
      TParent = class 
      end; 
      TParentClass = class of TParent; 
      TChild = class(TParent) 
      end; 
      TChildClass  = class  of TChild; 
   var 
     AParent, AParent2: TParent; 
     AChild,  AChild2:  TChild; 
     AParentClass: TParentClass; 
     AChildClass: TChildClass; 

       TParentClass       TParent ( 
   ), TChildClass       TChild (, 
 ,    ). 
           
   . ,  TParent,   , 
    TParentClass, a TChild   TChildClass. 

    90  I.   

             .  
           
,    ,      .  
      . 

AParentClass:=TParent; 	//   TParent    TParent.
AParentClass:=TChild;   //   TParent     TParent. 
AChildClass:=TChild;    //    TChild    TChild. 


        . 

    AChildClass:=TParent; // , TParent    TChild. 

       ,   TParent   
  TChild , ,       
  TChildClass. 
            
              
.        
     -,    . 

    AParent:=AParent2; //   . 
    AParent:=AChild;   //   . 
    AChild:=AChild2;   //   . 
    AChild:=AParent;   //   ,  AChild := AParent as    
                       //   Child ,   Aparent 
                       //     TChild   . 

        TObject - ClassType.  
TObject.ClassType       TClass,  
 TObject. ,     ,  TClass 
       .  -  
,   . 

    if AParent is TChild then 
      AChildClass:=TChildClass(AParent.ClassType) 
    else 
      AChildClass:=nil; 


      

    ,         Delphi,   
 .      , 
      ,    
  Object Pascal.       
 .     ,  
 Delphi.        
 Object Pascal.      Delphi    
       ,    Pascal  
.         . 
    ,  ,     
.      ,     
Delphi. ,        . 
      (RTL) Delphi     
 : System, SysUtils  Math.     , 
  ,     , , 
  ,       ,  
      uses. 

     System 

     System       Delphi.   
   ,     
  .     -,   
  ,      
    . 
     System    Object Pascal,    
    uses.   . 

     4. Object Pascal:   91 


     

      System     .   
  TDateTime,        : 

    Type TDateTime = Double; 

         ,   , 
   ,    .   
 ,     ,    
    . ,     TVarData 
       Variant,  
  TVarRec   ,    
   array of const. 

     

      System     .    
  var,      . 

    CmdLine: PChar=nil; 	//      . 
    CmdShow: Integer=0; 	//   ShowWindow. 
    FileMode: Byte=2;   	//     
    					//   (-). 
    Hinstance: longint=0;  	//        Windows. 
    InOutres: Integer=0;	//   -. 
    Input: Text;     		//   . 
    IsConsole: Boolean; 	//  True,     
    					//   . 
    Null: Variant=nil; 		//  True,   
    					//     . 
    Output: Text;  		//   . 
    RandSeed: longint=0; 	//     
    					//     . 
    Unassigned: Variant; 	//   True,    
					//        .
 
               
   .      
 . ,    InOutRes  
,   lOResult.    Input  Output 
  . 

     

      ,    ,   
System     ,     
.    . 

         

    BlockRead(F, Buffer,  	   Count    
      Count, Res)			  F   Buffer.    Buffer  
					 ,        
					 Count .     
					    Res 

    BlockWrite(F, Buffer, 	   Count     
      Count, Res)			 F   Buffer. -    
					     Res 

    ChDi(S} 			  S  

    GetDir(N, S) 			 N=0    S   .  
					N=1. . 26    ,  
					 N ( :  Z :) 

    MkDir(S) 			   

    ParamCount  			  ,     
					 

    ParamStr(N)  			 N-   .  N >ParamCount 
					  .  N=0     
					-   


    92  I.   


        

    Random 		  .   Random  
			 ,     
			0  1. Random(N),  N   ,   , 
			    0  N-1 

    Randomize  	        
			.       .  
			  Randomize       
			  .  ,        
			,     Random    
			 

    RmDir (S) 	    S 


     SysUtils 

      System   Delphi,  SysUtils   
  .       
,      ,    
,    .       
 Delphi  SysUtils     uses.  
,   ,    . 

     

     SysUtils   ,     
,    . 

       

            
   . 

    faReadOnly =  $00000001;	//       . 
    faHidden   =  $00000002;	//    . 
    faSysFile  =  $00000004;  //    . 
    faVolumelD =  $00000008;  //    . 
    faDirectory = $00000010;  //  . 
    faArchive =   $00000020;  //    . 
    faAnyFile =   $0000003F;  //       . 

            Or. 
        
.  ,    faAnyFile    
.       : 

    faAnyFile = faReadOnly or faHidden or faSysFile or faVolumelD 
                or faDirectory or faArchive; 


        

              
     . ,   TFileStream   
Create   Mode,       . 

    FmOpenRead   =  $0000;     //         . 
    FmOpenWrite  =  $0001;     //       . 
    FmOpenReadWrite = $0002;   //       . 
    FmShareCompat   =  $0004;  //        FCB. 
    FmShareExclusive =  $0010; //    . 
    FmShareDenyWrite =  $0020; //       . 
    FmShareDenyRead  =  $0030; //       . 
    FmShareDenyNone  =  $0040; //       . 

            
()  FileMode,    System. 

     4. Object Pascal:   93 


          

      SysUtils    "" ,  
 ,   Object Pascal,    
  . 

    fmClosed  =  $D7BO; 
    fmlnput   =  $D7B1; 
    fmOutput  =  $D7B2; 
    fmlnOut   =  $D7B3; 


     

      SysUtils    .     
    

    TFilename=string; 

        ,    
   , : 

    TFloatFormat =(ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency); 
    TFloatValue  =(fvExtended, vfCurrency); 

         ,   .  
  ,    . 

      TFileRec 
      TTextRec 
      LongRec 
      TFloatRec 
      THeapStatus 
      TMethod 
      WordRec 
      TSearchRec 

          TSearchRec.  
       . 
           ,    
 . ,   TFileRec  TTextRec   
Mode,        ""   
.      ,    
  Assign  AssignFile. 

     

      SysUtils    Exception   
     .   
    5, "  ". 

     

        ,   
 SysUtils,      .  
        
    GetLocalelnf   Win32Api.   
 .  ,        
WM_WININICHANGE.    Delphi   
     Application.UpdateFormatSettings. 
              
 LOCALE,   ,   
GetLocalelnf   Win32Api. 

        	 

    CurrencyString 	 ,     
				    . LOCALE_SCURRENCY -   
				,       
				.     '$' 
    CurrencyFormat              
				   . 
				  : 
				0 = '$1'                                                                    
				1  = 1'$'                                                                  
				2 = '$1' 
				3 = '1$' 
				      
				LOCALE_ICURRENCY 


    94  I.   


    	 

    NegCurFormat	    
			      . 
			  : 
			0 = ($1) 	8 = -1$ 
			1 = -$1	9 = -$1 
			2 = $-1	10 = 1$-
			3 = $1-	11 = $1-
			4 = (1$)	12 = $-1 
			5 = -1$	13 = 1-$ 
			6 = 1-$	14 = ($1) 
			7 = 1$	15 = (1$) 

           
    LOCALE_INEGCURR 

    ThousandSeparator 	          
				,     . 
				LOCALE_THOUSAND.     ,  , 
				 (,),     (.) 
    DecimalSeparator	,     . 
				LOCALE_SDECIMAL.     ,  , 
				  (.),     (,). 
				  ThousandSeparator

    CurrencyDecimals	 ,     
				   . LOCALE_ICURRDIGITS.   
				  ,  , 2,      
				 DateSeparator     ,    
				 . LOCALE_SDATE.       (/). 
				    (-) 
    ShortDateFormat 	      , 
				  .     DateSeparator  
				 m, mm, d, dd,       
				FormatDateString.    LOCALE_SSHORTDATE     
    LongtDateFormat	      ,   
				  . LOCALE_SLONGDATE 
    TimeSeparator 	  ,       
				. LOCALE_STIME.    (:) 
    TimeAMString		    00:00  11:59  12- . 
				LOCALE_S1159.     am, AM, A.M. 
    TimePMString   	    12:00  23:59  12- . 
				LOCALE_S2359.     pm,  PM, P.M. 
    ShortTimeFormat	       
				     .      
				LOCALE_ITIME  LOCALE_ITLZERO.     hhnn, 
				hh: nn  hh:nn  ampm 
    LongTimeFormat 	        
				 ,   .      
				 LOCALE_ITIME  LOCALE_ITLZERO 
    ShortMonthNames 	     .  
				      mmm  FormatDateTime. 
				LOCALE_SABBREVMONTHNAME.    Jan, Feb, Mar,..., Dec 
    LongMonthNames  	     .   
				     mmmm  FormatDateTime. 
				LOCALE_SMONTHNAME.    January, February,..., December 
    ShortDayNames  	      . 
				       ddd  
				FormatDateTime. LOCALE_SABBREVDAYNAME.    Sun, 
				Mon, Tue,..., Sat 
    LongDayNames 		      .   
				     dddd  FormatDateTime. 
				LOCALE_SDAYNAME.    Sunday, Monday, ..., Saturday 

     4. Object Pascal:   95 


     

      SysUtils    .   
  , < ,  ,   
.  ,      3}sUtils. 

      

      ,    ,  
 ,        
 . 

     		 

    AdjustLineBreaks(S)	 ,   CR/LF 
				( / ),   CR, LF  LF/CR 
    AnsiLowerCase(S)	   ,   
				    
    AnsiUpperCase(S)	   ,   
				    LowerCase (S} 
				 ,        
    Trim(S)			 ,         
				,     
    TrimLeft(S)		 ,         
				  
    TrimRight(S)		 ,         
				  
    Uppercase (3} 	 ,        

          (31  S2),  -1,  SKS2, 0, 
 S1=S2,  1,  S1>S2: -1. 

     			 

    AnsiCompareStr(S1, S2)	 ,    
					    
    AnsiCompareText(31, 32)	 ,    
					    
    CompareStr(31, 32)		    
    CompareText(31, 32)		    


         

             
 MkDir  RmDir.    . 
      CreateDir(Dirnarae).  True,   ,   
False.  
      RemoveDir(Dirname).  True,   ,   False. 

     / 

     ,  ,        : 

         Date (  ); 
         Now (    ); 
         Time (  ). 

            
       ( ,  )  
.    /    
Currency  Date/Time   SysUtils. 

            . 

    96  I.   

     		 

    DateTimeToStr(DT) 	       
    DateTimeToString(ResultStr,FormatStr, DT)    
				   
    DateToStr(DT)		      
    FormatDateTime 	       
    TimeToStr 		      


            TDateTime. 

     		 

    StrToDate(S) 		     
    StrToDateTime(S) 	    / 
    StrToTime(S) 		     


          . 

     		 

    DayOfWeek(DT) 	  ,     
				  TDateTime: 1=, 2=,..., 
				7= 
    DecodeDate		   
    DecodeTime		   
    DateTimeToFileDate	   Delphi    DOS 
    EncodeDate(Yyyy,Mm, Dd)     TDateTime 
    EncodeTime (Hour, Min, Sec, MSec)    TDateTime 
    FileDateToDateTime (Filedate)    DOS   Delphi 


           


        . 

     			 

    DeleteFile (Filename) 	 True,     
					,  False 
    FileAge(Filename) 		   
    FileCreate(Filename) 	     
    FileGetAttr (Filename)  	   
    FileSetAttr (Filename, NewAttr)     
    RenameFile(OldName, NewName)        


           . 

     			 

    FileExists(Filename)	 True,     
    FileSearch (Filename, DirList)       
    FindClose(SearchRec) 	  FindFirst/FindNext 
    FindFirst(FileSpec, Attr, SearchRec)       
					     
    FindNext(SearchRec)		  ,      
					   FindFirst 


     4. Object Pascal:   97 
    4  Delphi 3.   


         ,     
 .   ,  ,   . 

     				 

    ChangeFileExt(FileName, FileExt)         
    ExpandFileName(FileName) 		     ,   
    ExpandUNCFileName(FileName)  	       
						,   
    ExtractFileDir(FileName) 		    ,     
    ExtractFileDrive(FileName) 	  ,     
    ExtractFileExt(FileName)  	   
    ExtractFileName(FileName) 	    
    ExtractFilePath()  			      

             (   
- Objec Pascal).       
  . 

     			 

    FileClose (FileHandle)       
    FileGetDate (FileHandle)        
    FileOpen (FileName, Mode)       . 
					    -1    
    FileRead( FileHandle, Buffer, NumBytes)           
    FileSeek (FileHandle, Offset, Origin)      
    FileSetDate (FileHandle, 			    
    NewAge)						  
    FileWrite( FileHandle, Buffer, NumBytes)      


          . 

    DiskFree(Drive).      . 
  Drive: 0   , 1   :, 2   :  .. 
    DiskSize(Drive).    .   
Drive: 0  , 1   :, 2   :  .. 


          

             
 .      . 

     		 

    FloatToDecimal 	        
    FloatToStrF 		        
    FloatToStr(X) 	        
    FloatToText 		        
    FloatToTextFmt 	        
    FormatFloat 		        , 
				  Format 
    StrToFloat(S) 	       
    TextToFloat 		   -      
    IntToStr(X) 		     
    StrToInt(S) 		     


    98  I.   


       

      SysUtils     .  
       . 

     	 
    FmtStr 		   
    Format 		        
			  Pascal 
    FormatBuf 	   
    StrFmt 		   
    StrLFmt 	      
			    


        - 

      Syslnt         
-.    PChar,   String.   
        . 

     		 

    StrAlloc(Size) 	     - 
				 -1 
    StrBufSize(S) 	   ,   
				  ,    StrAlloc 
    StrCat(SI, S2)	  32    S1   
				    (52) 
    StrComp(Sl, S2) 	   
    StrCopy(Sl, S2) 	  52  S1 
    StrDispose (S) 	     
    StrECopy (S1, 52) 	        
				    
    StrEnd(S) 		     
    StrlComp (SI, S2) 	      
    StrLCat(Sl, 52) 	   S 2    S1  
				     (52) 
    StrLComp(Sl, 52) 	       
    StrLCopy(Sl, S2) 	       
    StrLen (S) 		      - S 
    StrLIComp (SI, S2)            
    StrLower (S) 		      
    StrMove(Sl, S2) 	       
    StrNew (S) 		         
    StrPas (S) 		   -    Pascal. 
				  String 
    StrPCopy(Sl, S2) 	   Pascal S2    - S1 
    StrPLCopy (SI, S2,    MaxLen     
    MaxLen) 		Pascal SI    - S2 
    StrPos(SI, S2) 	      S2  
				 S1 
    StrRScan(S, ) 	        
    StrScan(S, ) 	        
    StrUpper(S) 		      


     4. Object Pascal:   99 


     Math 

      Math   ,      
  .     Math     
 EInvalidArgument   TPaymentTime,    
 .     Math   
    . 

      

      ,       Math,   
   ,      
 ,      .    
  Math      . 

     	 

    Ceil(X) 	 ,     X 
    Floor(X) 	 ,     X 
    Hypot(X, Y) 	      X  Y 
    Log2(X) 	  X 
    LoglO(X) 	  X 
    LogN (X) 	  X (  "") 
    Power (X, Y)  X   Y 
    RandG (Mean, Variance)     
					      

      

       Pascal    , 
    ,    : 
Sin, Cos  ArcTan. ,   ,   
      .   
Math     ,   
,       
 (, ,   ). 

     	 

    ArcCos(X) 	  ,     X 
    ArcCosh(X) 	,    X 
    ArcSin(X)  	  ,     X 
    ArcSinh(X) 	,    X 
    ArcTan2(Y, X)	  ,    Y/X,    
    ArcTanh(X) 	,    X 
    Cosh(X) 	  X 
    Cotan(X)	 X,  
    CycleToRad(X)	   X  
    DegToRad(X)	   X  
    GradToRad(X)	   X  (1  = 400 ) 
    RadToCycle(X)	   X  
    RadToDeg(X)	   X  
    RadToGrad(X)	   X  (1  = 400 ) 
    Sinh(X) 	  X 
    () 		 X  
    Tanh(X) 	  X 


    100  I.   

  
      

       Delphi       
    .     , 
     . 

    DoubleDecliningBalance                                                     
    NumberOfPeriods 
    FutureValue 
    Payment 
    InterestPayment 
    PeriodPayment 
    InterestRate 
    PresentValue 
    InternalRateOfReturn 
    SLNDepreciation 
    NetPresentvalue 
    SYDDepreciation 


      

           
   . 

    MaxValue 
    PopnVariance 
    Mean 
    StdDev 
    MeanAndStdDev 
    Sum 
    MinValue 
    SumOfSquares 
    MomentSkewKurtosis 
    SumAndSquares 
    Norm 
    TotalVariance 
    PopnStdDev 
    Variance 


      

            
   ,     Math,  
     . 

     	 

    Frexp 		        
    IntPower(X, N)   X    N 
    Ldexp 		        
    LnXPl(X) 	    -1 
    SinCos              

     

       Delphi     
   Object Pascal. 
              
 . Delphi     ,  
 Form.         ( 
  Unitl),    : 

    Type TForml = class(TForm) 

       TForm     ,   
 .  TForm    Forms.     
   ,       
Forms,       Uses. Delphi     
  ,         
: Uses   ...,   Forms,    ...; 
        Forms  TForm     
   TScrollihgWinControl.  TForm   ,   
 ,       .   
     . 

    Type TForm =  class (TScrollingWinControl) 
     private         
       FOnCreate: TNotifyEvent; 


     4. Object Pascal:   101 


      function IsForm: Boolean; 
    published 
      property Caption  stored  IsForm; 
      property  OnCreate:   TNotifyEvent; 
        read  FOnCreate write  FOnCreate  stored  IsForm; 

       TNotifyEvent   - IsForm 
Boolean,        .   
      private,   ,    
  .       
(Caption  OnCreate),   published. 
      TScrollihgWinControl    , ,  
,         TObject. 

    TScrollihgWinControl  =  class(TWinControl) //     Forms. 
    TWinControl  =  class (TControl)    		//     Controls. 
    TControl  =     class(TComponent)      	//     Controls. 
    TComponent  =  class(TPersistent)           //     Classes.
    TPersistent =  class(TObject)   		//     Controls. 
    TObject  =  class   				//     System. 

           ,    
 .   Classes    ,  ,  
TNotifyEvent  TComponentClass. 

     
      TNotifyEvent = procedure(Sender:   TObject) of object; 
	TComponentClass = class of TComponent; 

     , TNotifyEvent       
 , TComponentClass     .  
  TNotifyEvent    OnCreate.  
TComponentClass   . 
      ,   ,     
TForm1,     ,      .  
, TForml   ,      
    .   Forml   
       TForml: 

    var Forml: TForm; 

       ,     . Delphi  
  .    (    
PROJECT1.DPR)   : 

    Application.CreateForm(TForml, Forml); 

    Application   ,     Forms.  
     Uses .  Application  
   TApplication: 

    var Application: TApplication;                                           

     TApplication    Forms  ,   
,    (    TComponent,  
).     ,     
   : 

    type TApplication = class(TComponent); procedure CreateForm( 
    InstanceClass:   TComponentClass;   var Reference); 

      TComponent   ,     TForm, , , 
   .  ,  Application   
TPersisitent  TObject. 
    Me TApplication.CreateForm     
  TComponent   :  TComponentClass  
  .       .   
  Application ,     ,  
      .
            ,       
TForm.    ,   ,     
,       ,    
     ,   TForm. 
,          Delphi 
        

    procedure  FormCreate(Sender:   TObject); 


    102  I.   

             : 

    procedure  TForml.FormCreate(Sender:   TObject); begin 
    end; 

     ,       
TNotifyEvent.    . Delphi      
OnCreate,       ,   
 ,      . ,  
   Caption      : 

    Caption := '3, !'; 

    ,  ,       ,  
     TForml.FormCreate.  Caption   
,   published   ,   
     Delphi.   
 ,      . 
     ,   Windows  ,  , 
,    ,  , 
         . 
      ,   
  .   Application   
    ,    : 

    Application.Run; 

      ! 
