!Dan Vallejo's WebLog!

Visual Studio .NET Developer

Explicit Implementation of Multiple Interfaces

If you have interfaces derived from other interfaces it makes explicit implementation of them a little funny in the class.

Notice that in the following code (class TestBar) when you implement IBar that you need to use IFoo even though the class only indicates that it's implementing IBar.

interface IFoo
{
    void Draw();
}

interface IBar : IFoo
{
    void GetString();
}
   
class TestBar : IBar
{
    void IFoo.Draw()
    {
    }
    void IBar.GetString()
    {
    }
}

Published Saturday, May 22, 2004 1:57 PM by DanVallejo
Filed under:

Comments

No Comments
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker