note 28402 rejected from keyword.parent by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 10:25:36 +0000 |
| Subject: | note 28402 rejected from keyword.parent by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57679@lists.php.net to get a copy of this message | ||
Note Submitter: rotes.bueffelfell@web.de
----
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