Tuesday, May 12, 2015

Interface (For Beginners)


  • What is an interface?
  • Where can we use an interface?
An interface contains only the signatures of methods, properties, events or indexers. A class or struct that implements the interface must implement the members of the interface that are specified in the interface definition.
Properties Of Interface:-
  • Supports multiple inheritance (Single Class can implement multiple interfaces).
  • Contains only incomplete method.
  • Cannot Contains data members.
  • By Default interface members is public (We Can not set any access modifier into interface members).
  •  Interface cannot contain constructors.
    interface IApp
     {
           int Sum(int i, int j); //By Default Public
     }
     class App : IApp
     {
     // Can use either this way
        public int sum(int i, int j) //Must be declare Public
        {
           return i + j;
        }
    // Second method 
       int IApp.sum(int i, int j) //No need to declare Public
        {
           return i + j;
        }
     }

Monday, May 11, 2015

test post!

welcome again post...