Breaking

Followers

Monday, 30 March 2015

What is difference between abstract class and interface classes.

Interface :- An interface does not contain any code,it contain only declaration of    methods,properties,events. Interfaces allow us to code which specifies which methods a class must have implement . Interfaces defines with the word interface . All methods in interfaces must be public
     interface myItem

                    {

                        void Id();
                       string description();
                        string Runtest(int testnumber);

                    }

 Abstract class :- Abstract classes are look like interfaces.Abstract classes may contain code although it may also have abstract method that do not have code. Abstract classes defines only signature of the method ,not implementation.  The child class which inherit the abstarct class must define all the abstarct methods of its parent class .

       abstract class myItem

                    {

                        abstract protected function getitem();
                        abstract protected function setitem();

                    }

No comments:

Post a Comment