[Help] Interface

0 views
Skip to first unread message

Narsimha

unread,
Feb 25, 2011, 1:07:58 AM2/25/11
to st_marys_m...@googlegroups.com

An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface, as shown in the following example:

 

 

      interface ISampleInterface

{

    void SampleMethod();

}

 

class ImplementationClass : ISampleInterface

{

    // Explicit interface member implementation:

    void ISampleInterface.SampleMethod()

    {

        // Method implementation.

    }

 

    static void Main()

    {

        // Declare an interface instance.

        ISampleInterface obj = new ImplementationClass();

 

        // Call the member.

        obj.SampleMethod();

    }

}

 

An interface can be a member of a namespace or a class and can contain signatures of the following members:

 

Methods

Properties

Indexers

Events

 

An interface can inherit from one or more base interfaces.

 

When a base type list contains a base class and interfaces, the base class must come first in the list.

 

A class that implements an interface can explicitly implement members of that interface. An explicitly implemented member cannot be accessed through a class instance, but only through an instance of the interface

 



--
Posted By Narsimha to Help at 2/25/2011 11:37:00 AM

Harish Mamidipelli

unread,
Feb 25, 2011, 7:54:12 AM2/25/11
to st_marys_m...@googlegroups.com
narsmiha,

Nuvvu coding chesthunnavu ani maaku telusu peddayanaaaa :):)


nuvvu pedda coder :)

Thanks
harish M



--
You received this message because you are subscribed to the Google Groups "St.Mary's PG college MCA Major's - 2000" group.
To post to this group, send email to st_marys_m...@googlegroups.com.
To unsubscribe from this group, send email to st_marys_majors_...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/st_marys_majors_2000?hl=en.

Reply all
Reply to author
Forward
0 new messages