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


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
How do I force the Dispose method to be called automatically, as clients can forget to call Dispose method? To Call the Dispose method in the Finalize method and in the Dispose

Project Description: I need to unlock software or make a similar kind of software. It is presently installed in my PC and I will provide you installation files if needed. It wil

how to access global resource file using javascript

What is Windows Workflow Foundation (WF)? Windows Workflow Foundation (WF) is a technology that was first introduced in .NET Framework 3.0. WF having of a programming model, a

What is a workflow? A workflow is a collection of actions (called activities) that presents the model of a process. A workflow gives a way to explain the order of the execution

Web application and XML data storage One person should create a library (Java package of classes) for managing the list of bibliography entries, and for saving and loading th

Why isn''t there an allowed amount for nonfacility for code 27405?

current available topics on computer graphics

What is ReaderWriter Locks? You may want to lock the resource only whenever data is being written and permit multiple clients to parallel read data when data is not being updat

What are similarities between Class and structure? The similarities between structures and classes are as follows:- 1) Both can have constructors, properties, methods, field