Просмотр поста

.
Delphinum

AlkatraZ, есть такая магия:

class My{
  private $a;

  public function __construct($a){
    $this->a = $a;
  }

  public function copy(My $obj){
    $this->a = $obj->a;
  }

  public function getA(){
    return $this->a;
  }
}

$a = new My(1);
$b = new My(2);
$b->copy($a);
echo $b->getA(); // 1