Results 1 to 2 of 2

Thread: what is an interface

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Answers
    7

    what is an interface

    what is interface in c#?


  2. #2
    Expert Member
    Join Date
    May 2009
    Answers
    1,374

    Re: what is an interface

    Hi Prakashraj,

    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();
    }
    }

    Thanks & Regards,
    Riju.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact