Scenario 10:-
First we will discuss implicit implementation of interface.
public interface MyInterface
{
int foo();
}
public class MyClass : MyInterface
{
private int a = 10;
public int foo()
{
return a;
}
}
MyClass obj = new MyClass();
MyInterface obj2 = (MyInterface) obj;
obj.foo(); //Returns 10
obj2.foo(); //Returns 10
Here foo is acting both as a class member as well as interface member.