Re: Multiple interface implementation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 23 Nov, 04:27, Raj <R...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
While implementing multiple interfaces having same method name, in the
derived class without explicit implementation, if only one method is
implemented like the below way, whether the .NET CLR will refer to interface
one or two? Since this leads to ambiguity, why is the .NET CLR not throwing
any warning or error??

Code snippet for observation:

interface int1
{
void test()

}

interface int2
{
void test()

}

class Program:int1,int2
{
   public void test()
   {
    Console.WriteLine("test");
   }

   pubic static void Main()
   {
        Program p=new Program();
        p.test();
        Console.Read();
   }

}

Thank you

Regards
Raj

It's all a question of how you would like to "interface" with your
class. I agree that your question doesn't make much sense. Are you
doing an exercise to understand interfaces or do you have a real world
example?


.



Relevant Pages

  • Re: Visitor pattern, code generation and additional sub classes
    ... this is a base class / interface. ...     void visitFoo; ... in all my visitor implementations ... ...
    (comp.object)
  • Problem getting events from C# to VJ++
    ... interface IWeatherEvents: IUnknown ... public delegate void WeatherChangedDelegate(int nTemperature); ... // float Temperature ... private float m_fTemperature = 0; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Question about Java updates installed?
    ... public long add(int a, int b) ... either encapsulate the add method in an interface and then ... void test() throws Exception { ... A multicast delegate was also possible. ...
    (comp.lang.java.advocacy)
  • Re: Multiple interface implementation
    ... derived class without explicit implementation, if only one method is implemented like the below way, whether the .NET CLR will refer to interface one or two? ... why is the .NET CLR not throwing any warning or error?? ... void test() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Ribbon and a checkbox (C++ ATL)
    ... public void Ribbon_onAction ... When I do a C# addin that has to support Outlook 2003 and later I use ribbon interface definitions based on a blog article by Andrew Whitechapel of the VSTO team in a RibbonInterop class and handle the callbacks in a RibbonX class. ... MethodCodeType = MethodCodeType.Runtime), DispId] get;} ... string Tag { ...
    (microsoft.public.outlook.program_addins)