[fpc-pascal] Casting descendant interface variables to base

Andrew Hall andrew.hall at shaw.ca
Mon Jan 31 06:09:55 CET 2011


Interfaces do not behave like classes.  Each each interface implemented/supported by a class is unique - at runtime a "descendent" interface is entirely unrelated to its ancestor. 

Regards Andrew.

On 30 Jan 11, at 20:37 , cobines wrote:

> Hello everyone,
> 
> I have attached a program about which I have a question.
> 
> Why does iBase have different value than iBaseAsBase? It seems simply
> assigning to interface variable doesn't change it to base interface, I
> have to explicitly use "as IBaseInterface". Is it correct?
> 
> Basically, I'm trying to determine in CopyToInterface function if the
> parameter points to the same object as Self.
> 
> --
> cobines
> <project1.lpr>_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list