Mam taki problem... (skąd my to znamy?

Mam obiekt USER i dziedziczący po nim STUDENT. Obiekt USER tworzy się automatycznie w mechanizmie sesji. Czasem jednak zachodzi potrzeba "rozbudowania" tego obiektu do STUDENT'a

Z góry dzięki. Pozdrawiam!
<?php $u = new User(); ... $student = new Student( $u ); ... if ( $student == $jakis_user ) // czyli porownanie obiektow bo $student != $u wiec ci sie to wysypie, ?>
<?php public function __construct( User $user ) { $this->id = $user->getID(); $this->firstNae = $user->getName(); // itd. } ?>
<?php function get_private_properties($obj, $inside=false) { if ($inside) { foreach ($matches[1] as $property) { $output[$property] = $obj->$property; return $output; } } else return $matches[1]; } ?>
<?php class A { private $a; protected $b; public $c; function __construct($a, $b, $c) { $this->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); ?>