Zend PHP 5.3 Certification Exam
Object Oriented Programming
Functions and Arrays
Data Format & Types
Strings and Patterns
Databases and SQL
Web Features 1
Which of the following keywords is used to prevent a method/class to be overridden by a subclass?
Answer option B is correct.
The final keyword is used to prevent a method/class to be overridden by a subclass. Access control modifiers/access specifiers are PHP keywords that affect the behavior of the class or function it precedes. PHP has a number of modifiers, which are listed in the following table:
It defines a constant feature. This variable or function cannot be overridden in an inherited class.
It specifies that a feature can be accessed only by code in the same class.
It specifies that a feature can be accessed only by code in a subclasses of the class where it is defined.
It specifies that a feature can be accessed by any other class.
It cannot be used directly. Hence, a user must have to inherit abstract function or method first.
© 2013 Zend PHP Certification Exam