On Fri, 26 May 2017, Dennis wrote:
I defined a generic TList<IMyInterface> //CORBA style interface
var
aInt : IMyInterface;
aObj : TObject;
begin
aInt := MyList.Items[0];
aObj := aInt as TObject;
writeln( IntToHex(LongWord(aInt),4));
writeln( IntToHex(LongWord(aObj),4)); //this will output a different
Hex value from previous writeln
//This is causing a problem to me because I later
MyList.Remove(aObj as IMyInterface);//will fail because it is not the
same as aInt and thus fail to locate the item to remove
Am I missing some fundamental understanding of interface reference?
Why do you think the interface and the object are the same ? They are not.
An interface is just a bunch of method pointers, and an object has instance
data associated with it. Hardly the same thing, I would think ?
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal