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

1 Answer

+1 vote
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 610 views
0 votes
1 answer 545 views
asked May 25, 2021 in General by Tester jjavelin (120 points)
0 votes
1 answer 1.4k views
0 votes
1 answer 595 views
asked Oct 29, 2021 in General by anonymous
0 votes
1 answer 12.5k views
asked Aug 19, 2016 in General by Shed
–1 vote
0 answers 5.6k views
asked Apr 6, 2017 in General by larrystanley (120 points)
...