πŸ“Š PHP
Q. What will be the output?
Code:
class A { public function test() { echo 'A'; } }
class B extends A { public function test() { echo 'B'; } }
$obj = new B();
$obj->test();
  • (A) A
  • (B) B
  • (C) Error
  • (D) AB
πŸ’¬ Discuss
βœ… Correct Answer: (B) B

Explanation: Method overriding: child class method is called.

Explanation by: Roshan
Method overriding: child class method is called.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
1
Total Visits
πŸ“½οΈ
8 d ago
Published
πŸŽ–οΈ
Roshan
Publisher
πŸ“ˆ
84%
Success Rate