[fpc-pascal] implements

Ryan Joseph ryan at thealchemistguild.com
Sat Sep 2 09:44:03 CEST 2017


> On Sep 2, 2017, at 2:35 PM, Sven Barth via fpc-pascal <fpc-pascal at 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




More information about the fpc-pascal mailing list