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 we upload a file in php?
How do you destroy a session?
Tell me what is the definition of a session?
how retrive the video file in php using video tag
What is the use of $_server["php_self"] variable?
Is array a key php?
How to get ip address of a server in php?
Is php a low level language?
Is time a dependent variable?
What is the use of php and mysql?
What is use of echo in php?
When a conditional statement is ended with an endif?
What is memcache?
How do I start a php session?
How to initiate a session in php?