Jump to content
wuwuxin

Ref to function used as interface?

Recommended Posts

  {$M+}
  ReadOnlyObservable<T> = reference to function: T;
  Observable<T> = interface(ReadOnlyObservable<T>)
  {$REGION 'Property Accessors'}
    procedure Invoke(const value: T); overload;
  {$ENDREGION}
    procedure Subscribe(const action: TAction<T>; trigger: TNotifyTrigger = AfterChange);
  end;

The above is taken from @Stefan Glienke's Knockoff project
https://bitbucket.org/sglienke/knockoff/src/master/Knockoff.Observable.pas

 

Can someone give me some heads up - is this some type of advanced usage of Delphi?   can "reference to functio: T" be used as the base interface?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×