1)是否可以将抽象类的引用存储在变量中,如下所示:
abstract class A implements X {}
$A = A; //This doesn't work
2)最终我希望能够将对抽象类的引用传递给方法或函数。
class Y { public function __construct(X $X){} }
$Y = new Y($A);
能够做这样的事情甚至是令人满意的:
abstract class A { public static $staticProperty; }
class Y {
public function __construct($X){
echo $X::$staticProperty; //Doesn't work
}
}
$Y = new Y('A');