Calling explicitly implemented interface method from derived class 
Author Message
 Calling explicitly implemented interface method from derived class

Look at the follow sample code:

interface IHello

{

    string SayHello();

Quote:
}

class HelloBase : IHello

{

    string IHello.SayHello()

    {

        return typeof(HelloBase).ToString() + " has talked";

    }

Quote:
}

class HelloDerived : HelloBase, IHello

{

    string IHello.SayHello()

    {

        // How do I call HelloBase's implementation of IHello here?

        return typeof(HelloDerived).ToString() + " has talked";

    }

Quote:
}

Both HelloBase and HelloDerived implement IHello explicitly.  Does anybody
know how to call base class' implementation in the derived class'
implementation, as indicated in the comment?

Thanks.

- Jinlei



Sun, 24 Oct 2004 05:49:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Derived Interface implemented in derived class not found

2. Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface

3. calling an interface method from another method in the same class

4. Calling methods in derived classes

5. Calling a derived classes method from a list iterator

6. Call methods of dynamically loaded classes via interface?

7. Calling OnDraw method Explicitly

8. Calling Class methods from Interface

9. Calling a class member's interface method from a non interface method on the parent class

10. Calling one Interface method into another Interface

11. How to Stop Derived Class from overriding base class method

12. Finding if a CoClass implements an interface that's derived from another

 

 
Powered by phpBB® Forum Software