How to call an explicitly implemented interface-method on the base class?

Unfortunately, it isn't possible Not even with a helper method. The helper method has the same problems as your second attempt: this is of type B even in the base class and will call the implementation of M in B.

Unfortunately, it isn't possible. Not even with a helper method. The helper method has the same problems as your second attempt: this is of type B, even in the base class and will call the implementation of M in B: interface I { int M(); } class A : I { int I.M() { return 1; } protected int CallM() { return (this as I).M(); } } class B : A, I { int I.M() { return CallM(); } } The only workaround would be a helper method in A that is used in A's implementation of M: interface I { int M(); } class A : I { int I.M() { return CallM(); } protected int CallM() { return 1; } } class B : A, I { int I.M() { return CallM(); } } But you would need to provide a method like this also for B if there will be a class C : B, I...

Yes that workaround is what I have added to the updated question. But it's not what I wanted to know. – M4N May 12 at 10:06 1 @M4N: That is just to make the answer a bit bigger ;-) The real answer is the first sentence: It is impossible without such workarounds.

– Daniel lgarth May 12 at 10:07 3 To add to why it's impossible: Explicitly implemented interface methods are made private - making them impossible to call from a derived class. You should probably prefer a different method like the one Daniel listed anyway, to avoid the call super code smell. – Mark H May 12 at 10:18 Thanks for explaining why it is impossible, I understand now.

– Amedio May 12 at 10:43 @M4N: Please don't forget to accept my answer if it helped you. – Daniel lgarth May 127 at 10:26.

Interface ISample {} class A : ISample {} class B : A {} ... base.fun(); ... msdn.microsoft.com/en-us/library/hfw7t1c...).aspx I have no idea its not possible call base method when it comes from implementation of interface.

No! B has a different implementation of the interface than A (it adds something to A's implementation). – M4N May 12 at 9:56 @M4N - Then you can only extend A override the method and make a base call to the method and continue implementing the method.

– Amedio May 12 at 10:00 See updated question. (explicit implementation is not necessary, but I was just wondering whether it's possible) – M4N May 12 at 10:03.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send