Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-05

Class Helper to implement an Interface

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

Reply by email

Marco van de Voort
to Marcos Douglas B. Santos

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.

Reply by email

Marcos Douglas B. Santos
to Marco van de Voort
Marco van de Voort wrote 5 lines
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.

Reply by email