An interface is a template that is defined as a contract and strictly
followed by inheriting class. The interface contains signature only means 'What'
part of the contract and deriving classes define the 'How' part of the contract.
Interfaces define properties, methods, and events, which are
the members of the interface. Interfaces contain only the declaration of the
members. It is the responsibility of the deriving class to define the members.
It often helps in providing a standard structure that the deriving classes
would follow.
An interface contains only the signatures of methods,
properties, events or indexers. Interfaces contain only declaration of the
member, default access modifier is public of declaring members of Interface but
you can't write with the declaration of members.
Example
interface MyInterface
{
void MyMethod();
}
class DerivedClass : MyInterface
{
// Explicit interface member Derived:
void MyInterface.MyMethod()
{
// Method Derived.
}
static void Main()
{
// Declare an interface instance.
MyInterface obj = new
DerivedClass();
// Call the member.
obj.MyMethod();
}
}
MongoDB concept to create and deploy a highly scalable and performance oriented database.
ReplyDeleteTo learn follow url : http://www.codefari.com/2015/02/mongodb-overview.html