[fpc-pascal] Question about interfaces and patch
mm10 at ellipsa.net
Fri Mar 25 00:38:01 CET 2005
Michael Van Canneyt wrote:
>>> On Thu, 24 Mar 2005 ml at brainwashers.org wrote:
>> procedure MyXYZPart.DoReport(aRep: IReportable);
>> if (aRep <> nil) then begin
>> if (aRep is ILogged) then
>> (aRep as ILogged).Log(aRep.Report)
> I see what you want, but if you would do
> procedure MyXYZPart.DoReport(aRep: TInterfacedObject);
> if (aRep <> nil) and arep is IReportable then begin
> if (aRep is ILogged) then
> (aRep as ILogged).Log(aRep.Report)
> you would have the same effect ?
Yes, in both cases, the compiler will stop because of a "begin"
without a "end". ;-)
More seriously, each time I see a "then begin", maybe I am wrong
but I immediately think that I have to deal with some code written
by a C programmer. And, curiously, I cannot find it reassuring.
More information about the fpc-pascal