Use of Interface in c#
An interface looks like a class, but has no implementation. The only thing it contains are definitions of events, indexers, methods and/or properties.The reason interfaces only provide definitions is because they are inherited by classes and structs, which must provide an implementation for each interface member defined.
example:
create an interface that contains a property LedgerName
Public interface myinterface
{
public string LedgerName
{get;}
{set;}
}
now inherite this interface into class Implement and implement that property
public class Implement:myinterface
{
string _LedgerName
public string LedgerName
{
get { return _LedgerName; }
set { _LedgerName = value; }
}
}
example:
create an interface that contains a property LedgerName
Public interface myinterface
{
public string LedgerName
{get;}
{set;}
}
now inherite this interface into class Implement and implement that property
public class Implement:myinterface
{
string _LedgerName
public string LedgerName
{
get { return _LedgerName; }
set { _LedgerName = value; }
}
}
Labels: Use of Interface in c#
1 Comments:
Its really helps to me.....
but will you give me the some explanation on Abstract and interface
By
Anonymous, At
January 18, 2010 at 1:46 AM
Post a Comment
Subscribe to Post Comments [Atom]
<< Home