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
Which function would you use to format date information in php?
Is it possible to use com component in php?
What is isset in php form?
Is php used in 2019?
What is difference between rest api and restful api?
How escape single quotes php?
What exactly is PHP?
What is difference between print and echo in php?
What type of headers have to be added in the mail function to attach a file?
Which database is best for php?
How does firefox manage cookies?
How is session data stored?
Do you know what is php?
What is regular expression in php?
Explain mail function in PHP with syntax?