4

It's in fact a feature that in most cases tlbimp will convert an interface to a coclass. Specifically if in IDL I have

interface IFirst {
}
interface ISecond {
    HRESULT GetFirst( IFirst** );
}

coclass First {
   interface IFirst;
}

then tlbimp will see that First is the only class to implement IFirst, so it creates a .NET interface where interface IFirst is replaced with class First

interface ISecond {
    First GetFirst(); // co-class returned, not interface
}

which is presumably helpful in some way.

How could this be useful? I mean class First will have the same methods as interface IFirst anyway, so it doesn't add anything, so without that conversion I could just pass interface IFirst everywhere and get exactly the same effect. What's the use of this conversion?

sharptooth
  • 167,383
  • 100
  • 513
  • 979

0 Answers0