Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 789 Bytes

0690.md

File metadata and controls

29 lines (24 loc) · 789 Bytes

What output will this code produce ?

class Disney {
    public $cartoon;
    function __construct($cartoon) {
        $this->cartoon = $cartoon;
    }
}

$disney = new Disney("The Beauty and The Beast");
$waltDisney = $disney;
$waltDisney->cartoon = "Pinocchio";
echo $disney->cartoon;
  • A) "Pinocchio" because $waltDisney and $Disney are pointing to the same object
  • B) "The Beauty and The Beast" because the $cartoon property in the $waltDisney object was changed
  • C) NULL because the Disney class was not instanciated inside the $waltDisney variable
  • D) an error
Answer

Answer: A