note 28402 added to keyword.parent

From: Date: Sun, 12 Jan 2003 02:11:59 +0000
Subject: note 28402 added to keyword.parent
Groups: php.notes 
Request: Send a blank email to php-notes+get-42010@lists.php.net to get a copy of this message
When using construtors, i'm searching for a different theme: How can i pass thru a variable functionparameter list to the parent constructor? class a { var a1,a2,a3; function a() { //simplified parameter-parsing for class A $arr=func_get_args(); $this->a1=array_shift($arr); $this->a2=array_shift($arr); $this->a3=array_shift($arr); return ( $arr ); /* an array containing args from index 3 up */ } } class b { var b1,b2,b3; //additional vars to the a's 1 to 3 function b() { $rest_of_func=parent::a(...???...); // how can i send here func_args to a's constructor, // not as array and not with eval, // but as variable parameter list??? $this->b1=$rest_of_func[0]; $this->b2=$rest_of_func[1]; $this->b3=$rest_of_func[2]; } } This maybe an common problem, or is there any solution? Since now i use complex eval-expression, but i don't like them and think there quit unuseful in combination with constructors instead simple functions. Greets sam -- http://www.php.net/manual/en/keyword.parent.php http://master.php.net/manage/user-notes.php?action=edit+28402 http://master.php.net/manage/user-notes.php?action=delete+28402 http://master.php.net/manage/user-notes.php?action=reject+28402

« previous php.notes (#42010) next »