Pass by reference
Hvorfor virker functionen "printKlasse1()" i Klasse2 ikke ??****************************
Klasse1 {
$var = "Hello";
}
****************************
Klasse2 {
var $klasse1;
function Klasse2(&$arg) {
$this->klasse1 = &$arg;
}
function printKlasse1() {
print $klasse1->var;
}
}
*****************************
require_once("Klasse1.php");
Klasse3 {
$klasse1 = new Klasse1();
$klasse3 = new Klasse2($klasse1);
}
*****************************