ExamVeda
Login
Home
This question belongs to PHP Object Oriented Concept
Object Oriented Concept
?

What will be the output of the following PHP code?
<?php
class ShopProductWriter
{
    public function write($shopProduct)
    {
      $str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})n";
      print $str;
    }
}
$product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 );
$writer = new ShopProductWriter();
$writer->write( $product1 );
?>

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.