How do you define an abstract class in PHP?
- abstract class ClassName
- class ClassName
- interface ClassName
- final class ClassName
To define an abstract class in PHP, you use the abstract keyword followed by the class keyword and the name of the class. For example: abstract class ClassName. This indicates that the class is intended to be an abstract class. Abstract classes can have abstract methods as well as non-abstract methods. Remember that abstract methods are declared but not implemented in the abstract class itself and must be implemented in the child classes that inherit from the abstract class. To learn more, see: http://php.net/manual/en/language.oop5.abstract.php
Loading...
Related Quiz
- What are some commonly used miscellaneous functions available in PHP?
- You are writing a PHP script and you need to filter multiple inputs. How would you do this?
- Associative arrays in PHP use numeric keys.
- In PHP, an interface is defined using the interface keyword.
- What are the differences between an abstract class and a regular class in PHP?