A directive was encountered during the parsing of an interface which is not allowed.
program Produce; type IBaseIntf = interface private procedure fnord(x, y, z : Integer); end; begin end.
In this example, the compiler gives an error when it encounters the private directive, as it is not allowed in interface types.
program Solve; type IBaseIntf = interface procedure fnord(x, y, z : Integer); end; TBaseClass = class (TInterfacedObject, IBaseIntf) private procedure fnord(x, y, z : Integer); end; procedure TBaseClass.fnord(x, y, z : Integer); begin end; begin end.
The only solution to this problem is to remove the offending directive from the interface definition. While interfaces do not actually support these directives, you can place the implementing method into the desired visibility section. In this example, placing the TBaseClass.fnord procedure into a private section should have the desired results.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!