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

1 Answer

+1 vote
answered by

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 581 views
0 votes
1 answer 9.9k views
asked Aug 19, 2016 in General by Shed
–1 vote
0 answers 4.7k views
asked Apr 6, 2017 in General by larrystanley (120 points)
0 votes
1 answer 6.5k views
asked Aug 5, 2016 in General by Elliot
0 votes
2 answers 2k views
0 votes
1 answer 5.2k views
...