Class Helper to implement an Interface

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Class Helper to implement an Interface

Marcos Douglas B. Santos
Hi,
Can I make a class helper to implements an Interface in an existing class?

For example, TStringList class has Find:

public function TStringList.Find(const S: string; out Index: Integer):Boolean;

Imagine an IFinder interface with the same method (only this method).
So, is it possible to make TStringList to implement IFinder using a
helper? If yes, which is the syntax?

Thanks,
Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Class Helper to implement an Interface

Marco van de Voort
In our previous episode, Marcos Douglas B. Santos said:
> Can I make a class helper to implements an Interface in an existing class?

No, since a change to the class is needed (the tables with methods). Helpers
are more an extra scope layered over the class without changing it.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Class Helper to implement an Interface

Marcos Douglas B. Santos
On Sat, May 26, 2018 at 4:56 PM, Marco van de Voort <[hidden email]> wrote:
> In our previous episode, Marcos Douglas B. Santos said:
>> Can I make a class helper to implements an Interface in an existing class?
>
> No, since a change to the class is needed (the tables with methods). Helpers
> are more an extra scope layered over the class without changing it.

All right. Thanks for this information.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal