Bird
0
0

Which statement about interface constants in PHP is correct?

hard📝 Conceptual Q10 of 15
PHP - Interfaces and Traits
Which statement about interface constants in PHP is correct?
AImplementing classes must redeclare all interface constants.
BInterface constants can be declared as private or protected.
CInterface constants cannot be overridden by implementing classes.
DInterface constants can be changed at runtime.
Step-by-Step Solution
Solution:
  1. Step 1: Recall interface constant rules

    Interface constants are fixed and cannot be overridden by implementing classes.
  2. Step 2: Evaluate other options

    Constants cannot be private/protected, classes do not redeclare them, and constants cannot change at runtime.
  3. Final Answer:

    Interface constants cannot be overridden by implementing classes. -> Option C
  4. Quick Check:

    Interface constants are fixed and public [OK]
Quick Trick: Interface constants are fixed and cannot be overridden [OK]
Common Mistakes:
  • Thinking interface constants can be private or protected
  • Assuming classes must redeclare constants
  • Trying to change constants at runtime

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes