
Asked in Infosys and 26 others
What is the difference between an abstract class and an interface in PHP? Give real-world use cases.

Abstract classes can have implementation; interfaces cannot. Both define contracts for subclasses but differ in flexibility and usage.
An abstract class can have both abstract methods (without implemen...read more
An abstract class is used as a base class from which other classes can inherit, it cannot be instantiated on its own and it uses the "extends" keyword while an interface is a contract that defines a s...read more
Abstract class and interface both are used to achieve abstract where we can declare the abstract methods.abstract class and interface both can't be instraniated .abstract class can have abstract and n...read more
Abstract class and interface both are used to achieve abstraction where we can declare the abstract methods. Abstract class and interface both con't be instantiated
abstract class :- It allows you to create functionality that subclasses can implement or override.
interface :- only allows you to define functionality, not implement it.
it Supports multiple inher...read more
Interview Questions from Popular Companies










Reviews
Interviews
Salaries
Users

