a = $a; $this->b = $b; $this->c = $c; } protected function getVariables() { return get_object_vars($this); } protected function setVariable($var,$value) { $this->$var = $value; } } class B extends A { public function __construct(A $objA) { foreach($objA->getVariables() as $key => $value) { $this->setVariable($key, $value); } } } $obj= new A('pierwsza', 'druga', 'trzecia'); $obj = new B($obj); var_dump($obj); // ["a:private"]=>"pierwsza" ["b:protected"]=>"druga" ["c"]=>"trzecia" ?>