Breaking News
Friday, 29 March 2013

What is interface in .net? , How to use interface in .Net?

The key word interface is use to define an interface. When you define interface you have not to define access modifier of any function (method) all method is public and in interface only declare method you cannot define method in interface.

For Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CA_Interface
    class Program:student
        public void print()
            Console.WriteLine("this is interface method");
        public static void Main(string[] args)
            Program obj = new Program();

    interface student
        void print();

Some rule for Method Overriding :
1). you cannot define method in interface.
2). you cannot define variable in interface.
3). you have to define method in class which interties the interface.
4). you can only declare method in interface.

See Also :
  Follow Me On Facebook

/\/ir@\/  <(.'.)>


Post a Comment

Thanks for comment

Toggle Footer