What is a Interface
What is a Interface ?
Interface is a contract that defines the signature of the functionality. So if a class is
implementing a interface it says to the outer world, that it provides specific behavior.
Example if a class is implementing Idisposable interface that means it has a functionality
to release unmanaged resources. Now external objects using this class know that it has
contract by which it can dispose unused unmanaged objects.
ã Single Class can implement multiple interfaces.
ã If a class implements a interface then it has to provide implementation to all its methods.
In sample there are two files.One has the interface definition and other class implements the interface. Below is the source code “IInterface” is the interface and “ClsDosomething” implements the “IInterface”. This 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
2007-10-23, 5158👍, 0💬
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notif...
How many types of validation controls are provided by ASP.NET ? There are six main types of validati...
What Is URI? URI (Uniform Resource Identifier) is a superset of URL. URI provides a simple and exten...
Can you explain project life cycle ? Figure :- 12.2 Life cycle of a project There are five stages of...
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want ...