I have a managed class that looks something like:

class Foo : IFoo
{
// Implementation of IFoo here
}

and another managed class that looks something like:

class Bar
{
  public void CallIFooMethod(IFoo i_pIFoo)
  {
  // Blah, blah, blah...
  }
}

>From an managed app, I have code that looks something like:

..
Foo NewFoo = new Foo();
Bar NewBar = new Bar();
NewBar.CallIFooMethod(NewFoo);
..

--------------------------------------------------------------
This code compiles fine, but at runtime I get a type cast exception from
the managed app when the CallIFooMethod method is called.  Why isn't there
an implicit type conversion from class type Foo to interface type IFoo if
class type Foo implements interface type IFoo?

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to