多个类 都有构造函数接受同样的参数 能优化下构造函数吗?
class A
{
public function __construct($a,$b,$c,$d,$e){
$this->a=$a;
$this->b=$b;
$this->c=$c;
$this->d=$d;
$this->e=$e;
}
}
class C
{
public function __construct($a,$b,$c,$d,$e){
$this->a=$a;
$this->b=$b;
$this->c=$c;
$this->d=$d;
$this->e=$e;
}
}
class D
{
public function __construct($a,$b,$c,$d,$e){
$this->a=$a;
$this->b=$b;
$this->c=$c;
$this->d=$d;
$this->e=$e;
}
}
这个能简化一下吗?
推荐文章: