Explicit interface implementation in C sharp Arabic #30
Suggested Videos
Introduction to interfaces in C sharp Arabic #29
❑ Explicit interface implementation.
Explicit interface implementation
❑ Question: A class inherits from 2 interfaces and the interfaces have the same method name . How should the class implement the method for both the interfaces?
We are using explicit interface Implementation technique to solve this problem.
Note: when a class explicitly Implements, an interface member ,the interface member Can no longer be accessed thru class reference variable, but only thru the interface reference variable .
Access modifiers are not allowed On explicitly implemented Interface members.
Default & Explicit Implementation
Note: if you want to mak4e one of the interface method, the default, Then implement that method normally and the other interface method explicitly. This makes the default method to be accessible thru class instance.
Tags:
C sharp