[fpc-pascal] Forward declarations
Jürgen Hestermann
juergen.hestermann at gmx.de
Fri Dec 23 07:24:06 CET 2011
Timothy Groves schrieb:
> Can anyone think of a situation in which you would *have* to use
> forward declared functions? I'm trying to come up with an example for
> such for my book, and I am drawing a blank.
>
Well, maybe this one:
-------------------------------------------------------------------
type SorterProcType = function (String1,String2 : shortstring) :
boolean;
function CompareIt1(String1,String2 : shortstring) : boolean; forward;
function CompareIt2(String1,String2 : shortstring) : boolean; forward;
function CompareIt3(String1,String2 : shortstring) : boolean; forward;
const SortCriteria : SortProcType = CompareIt1;
-------------------------------------------------------------------
I don't know of another way that you can use one of the "CompareIt1/2/3"
functions in the const declaration for "SortCriteria" (but maybe there
is one).
More information about the fpc-pascal
mailing list