1
vote
Vote UpVote

Implementing generic interfaces in Delphi

The Programming Works – Delphi supports generic interfaces; for example we can declare a generic interface type IChecker<T> = interface function Check(const Instance: T): Boolean; end; and use this generic interface as follows: unit UseDemo; interface uses GenChecks; type TDemo<T> = class private FChecker: IChecker<T>; public constructor Create(AChecker: IChecker<T>); procedure Check(AValue: T); end; implementation { TDemo<T> } procedure TDemo<T>.Check(AValue: T); begin if FChecker.Check(AValue) then Writeln('Passed') else ...
Favorite? Off-Topic? Serg @ 2014-06-04 19:17

Statistics

Visits: 750
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Peter
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)