Posts

Showing posts from October, 2016

Class Helper in Delphi. Is it useful or not ?

Class Helper Class Helper is a Type that associated with another Class, generally used to extend a class without using inheritance.  We can introduce new functionalities with additional methods and properties which can be used with members of associated class.  To declare a Class Helper we have to state a Helper name with associated Class name. The syntax for declaring a class helper is: type    TMyClassHelper =  class helper for TMyClass       memberList end; Example... // my Class // type     TMyClass = class        procedure MyProc;        function  MyFunc: Integer;     end;       ...      procedure TMyClass.MyProc;     var X: Integer;     begin        X := MyFunc;     end;     function TMyClass.MyFunc: Integer;     begin         ...     end;    ...  // Class Helper for TMyClass //  type     TMyClassHelper = class helper for TMyClass       procedure HelloWorld;       function MyFunc: Integer;     end;     ...       procedure TMyClassHelper.HelloWo