Jak powyżej, czemu wywala NULL'a ?
<?php
class Account
{
public $balance;
public function __construct(float $balance)
{
$this->balance = $balance;
}
}
class Person
{
private $name;
private $age;
private $id;
public $account;
public function __contruct(string $name, int $age, Account $account)
{
$this->name = $name;
$this->age = $age;
$this->account = $account;
}
public function setId(int $id)
{
$this->id = $id;
}
public function __clone()
{
$this->id = 0;
}
}
$person = new Person("bob",44, new Account(200));
$person->setId(343);
var_dump($person);
?>