Advertisement
Gov_777

Пример класса

Jun 18th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.86 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     procedure Button1Click(Sender: TObject);
  13.   private
  14.     { Private declarations }
  15.   public
  16.     { Public declarations }
  17.   end;
  18. type
  19.   Tblabla = class(TObject)
  20.     Surname: String;
  21.     Year: Integer;
  22.     function haha(i: integer): string;
  23.   end;
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.dfm}
  30.  
  31.  
  32.  
  33. function Tblabla.haha(i: integer): string;
  34. begin
  35. result:=IntToStr(i);
  36. end;
  37.  
  38. procedure TForm1.Button1Click(Sender: TObject);
  39. var   blabla1: Tblabla;
  40. begin
  41. blabla1:=Tblabla.Create;
  42. blabla1.Year:=40;
  43. blabla1.Surname:=blabla1.haha(blabla1.Year);
  44. showmessage(blabla1.Surname);
  45. FreeAndNil(blabla1);
  46. end;
  47. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement