What are the difference between abstract class and interface?
Answer Posted / khalid
A class implementing an interface must implement all of the
methods defined in the interface, while a class extending an
abstract class need not implement any of the methods defined
in the abstract class. Additionally, a class extending an
abstract class can implement an infinite number of it's own
methods.
another key difference between abstract class and interface
is that , in abstract class we can put sharable code, but
that is not possible in case of interface.
Another key difference between abstract class and interface
is that,
We can use interface as marker, ( we can use abstract class
also as abstract but then we can't extends any oter class,
so it is better always use interface as marker)
Marker===> An interface having no methods is called as a
Marker Interface.
| Is This Answer Correct ? | 24 Yes | 6 No |
Post New Answer View All Answers
how can i develop forum code? any one pleale help me on this question
What is the tags in PHP is not a valid way to begin and end a PHP code block?
How to call a php function from html button?
How cookies are transported from browsers to servers?
Why session is required?
What is default session time and path in php?
How is it possible to parse a configuration file?
What are some new features introduced in php7?
How is it possible to set an infinite execution time for php script?
What are the Formatting and Printing Strings available in PHP?
Tools used for drawing er diagrams?
What is Different between Joomla And Magento?
What does csrf token mean?
What are the main error types in php?
What is a PHP Filter?