Skip to content

Instantly share code, notes, and snippets.

@tangentstorm
Created January 19, 2013 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangentstorm/4574066 to your computer and use it in GitHub Desktop.
Save tangentstorm/4574066 to your computer and use it in GitHub Desktop.
Unit to demonstrate that free pascal does not complain when generic types promise to implement an interface but then do not.
{$mode objfpc}
unit generifaces;
{ Unit to demonstrate that free pascal does not complain
when generic types promise to implement an interface but
then do not. }
interface
type
IFoo = interface
function foo : byte;
end;
generic GBar<t> = class( TInterfacedObject, IFoo )
// does not implement foo, but compiler doesn't care.
end;
TBar = class( TInterfacedObject, IFoo )
// does not implement foo, and compiler complains
end;
implementation
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment