<<< Previous question <<< Question ID#0690.md >>> Next question >>>
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