阿罗哈:)
是否可以有一个带有引用作为参数的构造函数,然后从另一个类中使用它?
Class 1 named ABC
function __construct( $table, $key, &$db ){
$this->_tbl = $table;
$this->_tbl_key = $key;
$this->_db =& $db;
$this->_pkey = $key;
}
接下来我想在 XYZ 中使用 ABC。像这样:
$ABC= new ABC("dummytable", "id");
但显然这缺少一个参数,当我输入一个参数时,它返回一个关于参考的错误..
我该如何解决这个问题?
谢谢 :)