Bird
0
0

Which visibility keyword allows a property to be accessed from anywhere, including outside the class?

easy📝 Conceptual Q11 of 15
PHP - Classes and Objects
Which visibility keyword allows a property to be accessed from anywhere, including outside the class?
Aprivate
Bpublic
Cprotected
Dstatic
Step-by-Step Solution
Solution:
  1. Step 1: Understand visibility keywords

    Public properties can be accessed from anywhere, protected only within the class and subclasses, private only inside the class.
  2. Step 2: Identify which keyword allows outside access

    Only public allows access from outside the class.
  3. Final Answer:

    public -> Option B
  4. Quick Check:

    public = accessible everywhere [OK]
Quick Trick: Public means accessible everywhere, no restrictions [OK]
Common Mistakes:
  • Confusing protected with public
  • Thinking private allows outside access
  • Mixing static with visibility

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes