[fpc-devel] corba interface casting
    Paul Ishenin 
    paul.ishenin at gmail.com
       
    Mon Oct  1 15:38:47 CEST 2012
    
    
  
Hello, FPC developers' list
I have a code with 2 parent-child corba interfaces and 2 parent-child 
classes:
Intf1 = interface
   ...
end;
Intf2 = interface(Intf1)
   ...
   procedure DoSomething;
end;
Class1 = class
   Intf: Intf1;
   function GetIntf: Intf1; virtual;
end;
Class2 = class
   Intf: Intf2;
   function GetIntf: Intf1; override;
end;
function Class2.GetIntf: Intf1;
begin
   Result := Itnf; // this is Intf2
end;
var
   C: Class2;
   I: Intf2;
...
   I := Intf2(C.GetIntf);
Is this ^^^^ a correct interface cast? If not then how to cast one corba 
interface to another propely?
I'm asking because without -CR the code compiles and with it gives an 
error Error: Class or COM interface type expected, but got "Intf2"
Best regards,
Paul Ishenin.
    
    
More information about the fpc-devel
mailing list