> On Sep 2, 2017, at 2:35 PM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> Because you must use the interface and not the class instance:
> 
> === code begin ===
> 
> var
>   base: TBaseClass;
>   hook: IHook;
> begin
>   base := TBaseClass.Create;
>   hook := base;
> 
>   hook.DoIt; // will call base.hook.DoIt
> end;
> 
> === code end ===
> 

but then what is the purpose of this? It was almost a very powerful way to add 
methods to a class without subclassing (like class helpers) but the simple fact 
the “hook” identifier is not implied makes it useless. The only possible use of 
this I could think of is not needing to type “hook.” every time but since you 
need to anyways I just don’t get it.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to