You need to understand if an instance of an abstract class can be created in PHP. What would be your conclusion?

  • It can be created
  • It cannot be created
  • It depends on the code
  • None of the above
No, an instance of an abstract class cannot be created in PHP. Abstract classes are incomplete and serve as blueprints or templates for other classes. They cannot be instantiated directly because they may contain abstract methods that need to be implemented in the child classes. Attempting to create an instance of an abstract class will result in a runtime error. To utilize the functionality of an abstract class, you need to create an instance of a concrete child class that extends the abstract class. To know more, refer to: http://php.net/manual/en/language.oop5.abstract.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *