• Home
  • »
  • .NET General
  • »
  • what is interface? step by step procedure to use interface .
AuthorQuestion
what is interface? step by step procedure to use interface .
Posted on: 14 Dec 2012
what is interface? step by step procedure to use interface in asp.net using c#

With Regards Selvi.S
[ + ]
AuthorReply
Re: what is interface? step by step procedure to use interface .
Posted on: 14 Dec 2012  
Interface :

An interface contains only the signatures of methods, delegates or events. It contains only pure virtual methods which required to implement in the derived class that implements the interface.

Interfaces in C # provide a way to achieve runtime polymorphism.


public interface IPayment
{
    void MakePayment(string a, int b=0);
}



public class PayPay : IPayment
{
  public void MakePayment(string a); // it needs only one parameter
}

public class Google : IPayment
{
  public void MakePayment(string a, int b); // it needs two parameters.
}




Interface can be implemented implecitly or explicitly 

http://blogs.msdn.com/b/mhop/archive/2006/12/12/implicit-and-explicit-interface-implementations.aspx

SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter