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
How can we load multiple tables in a DataSet ? objCommand.CommandText = "Table1" objDataAdapter.Fill(objDataSet, "Table1") objCommand.CommandText = "Table2"

Why do we need static methods for Post Cache substitution? The ASP.NET should be able to call this static method even when there isn't an instance of your page class available.

Develop Nesting software with unit costing for gasket manufacturing Project Description: Our current gasket costing software is old and antiquated and has limited use interna

Explain different software development life cycles. The System Development Life Cycle (SDLC) is the overall process of developing information systems through multi stage proces

Program of Custom Console Output - C# Program Hello guys i need your advice. How can i implement the custom console output in my project. Please recommend some examples.

How to Creating a Key Pair ? You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension. To create a key pair At the comman

The Problem with finalize is that the garbage collection has to make 2  rounds in order to remove the  objects which have finalize methods. The figure below will make things cle

What are abstract classes? The features of the abstract class are as follows:- 1.     You can not create an object of the abstract class. 2.     The Abstract class is des

Our company is seeking a talented PHP Developer to join our young and dynamic online media agency. Must have: - Knowledge in SQL and Databases, proven indexing and coding exp

Jquery and MVC 4.5 Training Session I am looking who have industry experience working on Microsoft Technology ( MVC 4.5 ) and Jquery, who will take live online session and provi