C# Beginner to advanced - Lesson 26 - Explicit Interfaces Part 2

مجله خبری، آموزشی پرشین تک
منتشر شده در 11 خرداد 1397

Explicit Interface Implementation


If a class inherits from two interfaces and both interfaces have the same method name, in this scenario how class can implement the method for both the interfaces, at this point of time we will use “Explicit Interface Implementation” technique.

When a class explicitly implements, an interface member, the interface member can no longer be accessed through class reference variable, but only through the interface reference variable.

Access modifiers are not allowed on explicitly implemented interface members.


Default and Explicit Implementation:


If you want to make 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 through class instance.


ankpro

ankpro training

Asp.net MVC

C#

C sharp

Bangalore

Rajajinagar

Selenium

Coded UI

Mobile automation testing

Mobile testing

JQuery

JavaScript

.Net

Components of the .Net framework

Hello World

Literal

Keywords

Variable

Data types

Operators

Branching

Loops

Arrays

ArrayList

Strings

String Builder

Structures

Enums

Functions

Classes

Inheritance

Polymorphism

Properties

Indexers

Events

Nested Classes

Delegates

Anonymous methods

Labda expressions

Abstract classes

Exception Handling

Linq

Interfaces

Extension methods

Anonymous types

Generics

Collections

Garbage Collection

Reflection

Attributes

Input and output statements

Type casting

Boxing and Unboxing

Var vs Dynamic vs Object

دیدگاه کاربران