MCQs > IT & Programming > LAMP > The Manager and Office classes are as follows: Which should replace '???' to obtain the value of printName() function?

LAMP MCQs

The Manager and Office classes are as follows:

<?php
   class Manager{   
       function printName() {
             echo "Manager";
       }
   }
   class Office{
       function getManager() {
             return new Manager();
       }
   }
$ofc = new Office();
???
?>

Which of the following should replace '???' to obtain the value of printName() function?

Answer

Correct Answer: $ofc->getManager()->printName();

Explanation:

Note: This Question is unanswered, help us to find answer for this one

LAMP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

LAMP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it