Bird
0
0

Which keyword is used in PHP to call a method from the parent class inside a child class?

easy📝 Conceptual Q2 of 15
PHP - Inheritance and Polymorphism
Which keyword is used in PHP to call a method from the parent class inside a child class?
Aparent
Bsuper
Cbase
Dthis
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP syntax for parent method calls

    PHP uses the keyword parent to access parent class methods from a child.
  2. Step 2: Compare with other options

    Keywords like super or base are used in other languages, not PHP.
  3. Final Answer:

    parent -> Option A
  4. Quick Check:

    Parent method call keyword = parent [OK]
Quick Trick: Use 'parent' to call parent class methods in PHP [OK]
Common Mistakes:
  • Using 'super' instead of 'parent'
  • Using 'this' to call parent methods
  • Confusing with other language keywords

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes