Created
January 19, 2013 18:13
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$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