What is difference between abstract class and interface classes?

0 votes
600 views
asked Jan 2 in General by caki
Can someone tell me in simple words, the actual difference between abstract class and interface classes?

1 Answer

0 votes
answered Jan 2 by cupc

Google and you will find it. This is not a question to answer, but to learn yourself as all others do.

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
           e.g :     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 .

         e.g        abstract class myItem

                    {

                        abstract protected function gettheitem();
                        abstract protected function settheitem();

                    }

Related questions

0 votes
1 answer 532 views
0 votes
1 answer 3879 views
asked Aug 19, 2016 in General by Shed
–1 vote
0 answers 2387 views
asked Apr 6, 2017 in General by larrystanley (120 points)
0 votes
1 answer 3346 views
asked Aug 5, 2016 in General by Elliot
0 votes
1 answer 697 views
0 votes
2 answers 2493 views
...