Deference between Delegates and Interface in C#

Now we are going learn about the deference between the delegates and interface.
  • 5019

Introduction

In this article we are discuss about the what are the deference between delegates and interface.


                Delegates
 

                    Interface


Delegates is basically as function pointer.

A class inherit the property of the another class.

Delegates holds the ref. of methods.
 

There are two type of the interface in C# Implicit interface and explicit interface.

Delegates are ref. type variable.
 

An interface like a contract.

We can use delegate to call the methods of other objects.
 

 When a person sighs a contract they are agreeing to perform in adherence to it's contents.

It wraps up the memory address of a function.
 

it hade similar concept.

Delegates are often used to implements callbacks and events listeners.

Multiple inheritance can only implements with interface.

delegates are used in Cases of Events handling, callback, Linq etc.
 

Inter face are used when one class inherits the properties of another class.

© 2013 dotNetheaven. All rights reserved.