Interface, DOT NET Programming

What is a Interface?

The Interface is a contract that describes the signature of the functionality. So when a class is implementing a interface it says to the outer world, that it provides specific behavior. For example if a class is implementing Idisposable interface which means it has a functionality to release unmanaged resources. Now all the external objects using this class know that it has contract by which it can dispose unused unmanaged objects.

1.     The Single Class can implement multiple interfaces.

2.     If a class implements the interface then it has to provide implementation to all its methods.

In the sample there are 2 files. One has the definition of interface and other class implements the interface. Below is the source code "IInterface" is the interface and "ClsDosomething" implements the "IInterface". The  sample just displays a simple message box.

Public Interface IInterFace

 Sub DoSomething()

 End Interface

 Public Class ClsDoSomething

Implements IInterFace

 Public Sub DoSomething() Implements WindowsInterFace.IInterFace.DoSomething MsgBox("Interface implemented") End Sub

 End Class

38_Interface.png

Figure:-Interface in action

Posted Date: 9/21/2012 8:49:04 AM | Location : United States







Related Discussions:- Interface, Assignment Help, Ask Question on Interface, Get Answer, Expert's Help, Interface Discussions

Write discussion on Interface
Your posts are moderated
Related Questions
I have the working code I''m using to print the SQL table right now. I just need code to print in reverse order.

I need Professional TELERIK WinForm Project Description: Professional TELERIK Professional assistance in  TELERIK WinForm via remote control. Development WinForm in C #


Wowza expert required Project Description: Seeking wowza expert to teach our webmaster. To provide: How configure wowza to live transcoder. How allow add live transc

What are Windows services? Windows services, previously called as NT services, are applications that are installed on the system as system services. In other words, Windows ser

State the advantages of XML schemas over DTD. Microsoft developed a language called as the XML Schema Definition (XSD) to explain the schema to an XML document. The following a

What is different overloading and overriding, please explain

A Super-hero SharePoint developer with great design skills Project Description: US: Our start-up company prepares a very innovative and cool SharePoint related product with c

A few changes to OutloProject Description: We require someone who is familiar with programming plug-in to work with Microsoft Outlook. Initially we just require a simple chan

Can you define what inheritance is and an example of when you might use it? The process of deriving a new class from an existing class is known as Inheritance. The old class is