Can an instance of an abstract class be created in PHP?
- Yes
- No
- nan
- nan
No, an instance of an abstract class cannot be created in PHP. An abstract class cannot be instantiated directly because it is incomplete and serves as a blueprint for other classes. Abstract classes can only be inherited by child classes, which must provide implementations for the abstract methods. 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
Loading...
Related Quiz
- Which of the following actions are commonly performed on files in PHP?
- You need to replace a certain word in a string in your PHP script. How would you do this?
- What are some of the key concepts in Object-Oriented Programming in PHP?
- If you try to use a foreach loop on a non-array variable in PHP, it will result in a ______.
- A PHP while loop will always execute its block of code ______.