Guest User

http://stackoverflow.com/questions/17652922/automatically-fr

a guest
Jul 15th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.37 KB | None | 0 0
  1. type myClass = class(TMyInterfacedObject)
  2.          public
  3.             destructor Destroy; override;
  4.      end;
  5.  
  6. destructor myClass.Destroy;
  7. begin
  8.    do cleanup
  9. end;
  10.  
  11. procedure MyProcedure;
  12. var IGuard: iInterface;
  13. begin
  14.    ...
  15.    IGuard := myClass.Create(acquire resources);
  16. ....
  17. end;  // IGuard is automatically decremented here and myClass destructor is called
Add Comment
Please, Sign In to add comment